i am trying to work around using the following function because my ISP does not have mhash installed or compiled with php. (see- mhash.sourcefourge.net). Any help would be greatly appreciated 🙂

function hmac ($key, $data)
{
return (bin2hex (mhash(MHASH_MD5, $data, $key)));
}

    this is just an agorithm... and should be duplicatable in straight php as php does have bit manipluation stuff... at a performance cost of course...

    but download the source from sourceforge... and look for the mhash_md5.h and md5.c functions in the lib direcotry of the source...

    it might take a few hours... but it would be good fun to just rewrite it in php...

      I think I'll leave that to you guys... no thanks, hehe

        i need to generate hmac not md5. i thought about trying to do it by hand using php bitwise manipulation as suggested, but i think i'm out of my league. i was hoping someone had dealt with this elsewhere.

          no previous experience with this but...

          do you have a link of an easier place than the source code i mentioned for an explaination of what exactly the hmac does?

          maybe someone could help you along with the bit manipulation

            I've got a perl version... see: [url]ftp://mateosian.com/SimHMAC.pm[/url]

              ok well... im not going to translate it for you... but if you are familiar with perl at all... you should be able to find equivelant function calls and structure with php...

              so you just need to step through line by line... and copy function for function... and then just translate each perl call to php...

              should be doable just time consuming...but by the time your done, you should understand the shit out of hmac-ing

              🙂

              do you think that is doable or just too much hassle

                I do think it's doable to convert the perl scripts to php. In the short term I modified the perl and used the php exec command to simply dump off the work. It's a good solution for me because I ultimately want it to be pure php, but time was not permitting the full conversion. Now I can do it at a more comfortable pace. It works great...

                $get_fp = "cgi-bin/hmac/get_fp.pl --x_amount=$x_Amount";
                exec($get_fp, $return_array, $return_val);

                  that works just as well...

                  just be sure to do an absurd amount of checking on your variable before you pass it to the command line... it could be very very dangerous

                    Write a Reply...