首先,我看到要使用CRYPT_BLOWFISH,我需要使用以$2a $开头的16个char盐.但是,
php.net documentation for crypt()表示某些系统不支持CRYPT_BLOWFISH.这种情况多久一次?
接下来,从他们在docs上的例子中,我看到我使用crypt()如下:
$password = crypt('mypassword'); // let the salt be automatically generated
/* You should pass the entire results of crypt() as the salt for comparing a
password, to avoid problems when different hashing algorithms are used. (As
it says above, standard DES-based password hashing uses a 2-character salt,
but MD5-based hashing uses 12.) */
if (crypt($user_input, $password) == $password) {
echo "Password verified!";
}
?>
为了使用CRYPT_BLOWFISH,我唯一需要修改的就是第一行才能使它像这样;
crypt('mypassword', '$2a$07$usesomesillystringforsalt$')
然后其余的线路都很好吗?