note 11991 added to function.md5.php
| From: | gh at php2 dot chek dot com | Date: | Fri, 16 Mar 2001 19:11:08 +0000 |
| Subject: | note 11991 added to function.md5.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12478@lists.php.net to get a copy of this message | ||
Beware that you do not want to send R-MD5-encrypted strings to a database. After a day debugging
very strange problems, it became clear that Postgres (which I've never had any problems with)
was very confused and needed a cold boot or two.
So if you're going to store the encrypted value to a db, use base64 encoding. That is, replace
the first line of decrypt() with
$txt = keyED(base64_decode($txt));
and the last line of encrypt() with
return base64_encode(keyED($tmp));
(For some reason i didn't get to the bottom of, using addslashes() and stripcslashes() instead,
eg,
return addcslashes(keyED($tmp),"\0..\57\72..\377");
didn't work.)
http://www.php.net/manual/en/function.md5.php