note 105793 deleted from function.md5 by googleguy

From: Date: Sat, 12 Jan 2013 11:03:08 +0000
Subject: note 105793 deleted from function.md5 by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-192982@lists.php.net to get a copy of this message
Note Submitter: David Foley (dev at davidfoley dot org) ---- If you are using Dojo toolkit's "dojox.encoding.digests.MD5()" to generate an MD5 hash on the client side, you may run in to difficulty. Dojo returns a base 64 encoded MD5 hash, and as a result is not the same as PHPs. This is an issue when trying to verify a hash. To get the Dojo style hash from PHP use the following: <?php /** * Function to generate base 64 encoded hash * in the the style of dojox.encoding.digests.MD5() * * @param string $data Data to be hased * @return string base64 encoded MD5 hash */ function md5_base64($data) { return base64_encode(pack('H*',md5($data))); } ?>

« previous php.notes (#192982) next »