php - password_hash() PASSWORD_DEFAULT PHP 5.5

标签 php

来自 password_hash() 函数:

PASSWORD_DEFAULT - Use the bcrypt algorithm (default as of PHP 5.5.0). Note that this constant is designed to change over time as new and stronger algorithms are added to PHP. For that reason, the length of the result from using this identifier can change over time. Therefore, it is recommended to store the result in a database column that can expand beyond 60 characters (255 characters would be a good choice).

这是否意味着每当 PASSWORD_DEFAULT 更改时,我将无法使用新的 php 版本,否则 password_verify() 将无法正确检查旧用户密码?

最佳答案

不,password_verify() 将识别所使用的算法,因为它嵌入在您要验证的散列中:散列的第一部分(例如 $2y$)表示

关于php - password_hash() PASSWORD_DEFAULT PHP 5.5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28033298/

相关文章:

php - 通过 Web 浏览器 (PHP) 重新启动 Linux 服务器

javascript - 如何在 html <a> 标签中设置 href

php - 自定义 Facebook 分享按钮

php - 轻松计算和列出二进制组合

php - 将 Zend 1 包装到 Symfony 2 中。如何共享 session ?

javascript - 使用 PHP/JavaScript 链接获取有关网站访问者的信息

php - 将表单与 PHP 脚本链接以从数据库中检索数据

php - 计算成功执行PDO php的execute()次数

php - 如何在 Laravel 中验证时间

php - Cakephp - 如何加密然后解密正在存储和从数据库检索的数据