跳至主要內容

文章

顯示從 9月, 2022 起發佈的文章

PHP 使用 blowfish 完成登入加解密

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