PHP 使用 blowfish 完成使用者密碼加密及登入時的解密相當簡單。
語法
$password = crypt($password,"$2a$09$anexamplestringforsalt$");
這邊的 $2a$09$anexamplestringforsalt$ 就是加密的鑰匙。
解密
解密只要把加密過後的密碼當作鑰匙即可。
$password = crypt($password,<encrypted password with the same salt>);
PHP 使用 blowfish 完成使用者密碼加密及登入時的解密相當簡單。
$password = crypt($password,"$2a$09$anexamplestringforsalt$");
這邊的 $2a$09$anexamplestringforsalt$ 就是加密的鑰匙。
$password = crypt($password,<encrypted password with the same salt>);
留言
發佈留言