note 105918 added to function.crypt
| From: | Anonymous at osu1 dot php dot net | Date: | Sun, 25 Sep 2011 16:27:50 +0000 |
| Subject: | note 105918 added to function.crypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183420@lists.php.net to get a copy of this message | ||
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
----
Server IP: 69.147.83.197
Probable Submitter: 97.104.194.179
----
Manual Page -- http://www.php.net/manual/en/function.crypt.php
Edit -- https://master.php.net/note/edit/105918
Del: integrated -- https://master.php.net/note/delete/105918/integrated
Del: useless -- https://master.php.net/note/delete/105918/useless
Del: bad code -- https://master.php.net/note/delete/105918/bad+code
Del: spam -- https://master.php.net/note/delete/105918/spam
Del: non-english -- https://master.php.net/note/delete/105918/non-english
Del: in docs -- https://master.php.net/note/delete/105918/in+docs
Del: other reasons-- https://master.php.net/note/delete/105918
Reject -- https://master.php.net/note/reject/105918
Search -- https://master.php.net/manage/user-notes.php