note 105918 deleted from function.crypt by danbrown
| From: | danbrown@php.net | Date: | Mon, 26 Sep 2011 14:47:49 +0000 |
| Subject: | note 105918 deleted from function.crypt by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183438@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
I am having trouble with crypt using Blowfish.
For whatever reason the function is not returning the last character of the salt.
FOR EXAMPLE
$salt = substr(str_replace('+', '.', base64_encode(pack('N4',
mt_rand(), mt_rand(), mt_rand(), mt_rand()))), 0, 22);
$salt = '$2a$07$' . $salt;
$password = "thepassword";
if(CRYPT_BLOWFISH == 1){
echo 'The Salt: ' . $salt;
echo "\r\n";
echo 'Returned: ' . crypt($password, $salt);
}
RETURNS:
The Salt: $2a$07$VL21wnXniiVxm8cXWnuHcw
Returned: $2a$07$VL21wnXniiVxm8cXWnuHcuaX0Me50aHLgNdsOFjGW.FqOWP0Nsk72