linux php不支持crypt,(PHP)如何在CRYPT_BLOWFISH中使用crypt()?
首先,我看到要使用CRYPT_BLOWFISH,我需要用$ 2a $開頭的16個字符的鹽。但php.net documentation for crypt()表示某些系統不支持CRYPT_BLOWFISH。這種情況多久?(PHP)如何在CRYPT_BLOWFISH中使用crypt()?
接下來,他們對文檔的例子,我看到我用的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$')
然后其余的行都很好嗎?
2010-02-10
sepiroth
總結
以上是生活随笔為你收集整理的linux php不支持crypt,(PHP)如何在CRYPT_BLOWFISH中使用crypt()?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux脚本 set env,linu
- 下一篇: Linux先发送条件变量,浅谈Linux