3 回答
TA贡献1828条经验 获得超13个赞
password_hash
$password = $_POST['password'];
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
var_dump($hashed_password);
// Query the database for username and password// ...if(password_verify($password, $hashed_password)) {
// If the password inputs matched the hashed password in the database
// Do something, you know... log them in.} // Else, Redirect them back to the login page.TA贡献1829条经验 获得超13个赞
// Hash a new password for storing in the database.// The function automatically generates a cryptographically safe salt. $hashToStoreInDb = password_hash($_POST['password'], PASSWORD_DEFAULT); // Check if the hash of the entered login password, matches the stored hash. // The salt and the cost factor will be extracted from $existingHashFromDb.$isPasswordCorrect = password_verify ($_POST['password'], $existingHashFromDb);
TA贡献1852条经验 获得超1个赞
password_hash()
使用的算法 参数 食盐 实际密码散列
- 3 回答
- 0 关注
- 604 浏览
添加回答
举报
