note 111660 added to function.crypt
| From: | DenverTimothy | Date: | Wed, 13 Mar 2013 17:28:43 +0000 |
| Subject: | note 111660 added to function.crypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194059@lists.php.net to get a copy of this message | ||
Here is my blowfish-crypt function:
<?php
function bcrypt($input, $salt=null, $rounds=12) {
if($rounds < 4 || $rounds > 31) $rounds = 12;
if(is_null($salt)) $salt = sprintf('$2a$%02d$',
$rounds).substr(str_replace('+', '.', base64_encode(pack('N4',
mt_rand(), mt_rand(), mt_rand(), mt_rand()))), 0, 22);
return crypt($input, $salt);
}
$hash = bcrypt('password');
if($hash = bcrypt('password', $hash)) {
// password ok
}
?>
----
Server IP: 69.147.83.199
Probable Submitter: 23.30.51.129
----
Manual Page -- http://php.net/manual/en/function.crypt.php
Edit -- https://master.php.net/note/edit/111660
Del: integrated -- https://master.php.net/note/delete/111660/integrated
Del: useless -- https://master.php.net/note/delete/111660/useless
Del: bad code -- https://master.php.net/note/delete/111660/bad+code
Del: spam -- https://master.php.net/note/delete/111660/spam
Del: non-english -- https://master.php.net/note/delete/111660/non-english
Del: in docs -- https://master.php.net/note/delete/111660/in+docs
Del: other reasons-- https://master.php.net/note/delete/111660
Reject -- https://master.php.net/note/reject/111660
Search -- https://master.php.net/manage/user-notes.php