note 31030 added to function.md5
| From: | lee at rack1 dot php dot net | Date: | Mon, 07 Apr 2003 17:01:43 +0000 |
| Subject: | note 31030 added to function.md5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46313@lists.php.net to get a copy of this message | ||
There is an extremely frusturating incompatibility between php and Perl's md5() and crypt()
functions. I hope someone can prove me wrong on this, because I'm having trouble finding any
writing on the internet about it, yet it seems like a big problem.
Hexidecimal hashes generated with Perl's Digest::MD5 module WILL NOT equal hashes generated
with php's md5() function if the input text contains any non-alphanumeric characters.
Example:
the correct password is "pa$$"
$hash = md5($password);
$phphash = md5('pa$$');
echo "plaintext password from user input: $password";
echo "hash from textfield: $hash";
echo "php original hash from text: $phphash";
echo "md5 hash from perl: " . $myrow['password'];
outputs:
plaintext password: pa$$
hash from textfield: 0aed5d740d7fab4201e885019a36eace
php original hash from text: 0aed5d740d7fab4201e885019a36eace
hash from perl: c18c9c57cb3658a50de06491a70b75cd
--
http://www.php.net/manual/en/function.md5.php
http://master.php.net/manage/user-notes.php?action=edit+31030
http://master.php.net/manage/user-notes.php?action=delete+31030
http://master.php.net/manage/user-notes.php?action=reject+31030