note 105793 added to function.md5

From: Date: Thu, 15 Sep 2011 13:54:03 +0000
Subject: note 105793 added to function.md5
Groups: php.notes 
Request: Send a blank email to php-notes+get-183185@lists.php.net to get a copy of this message
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))); } ?> ---- Server IP: 89.185.144.38 Probable Submitter: 86.46.68.16 ---- Manual Page -- http://www.php.net/manual/en/function.md5.php Edit -- https://master.php.net/note/edit/105793 Del: integrated -- https://master.php.net/note/delete/105793/integrated Del: useless -- https://master.php.net/note/delete/105793/useless Del: bad code -- https://master.php.net/note/delete/105793/bad+code Del: spam -- https://master.php.net/note/delete/105793/spam Del: non-english -- https://master.php.net/note/delete/105793/non-english Del: in docs -- https://master.php.net/note/delete/105793/in+docs Del: other reasons-- https://master.php.net/note/delete/105793 Reject -- https://master.php.net/note/reject/105793 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#183185) next »