微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

password_hash()PASSWORD_DEFAULT PHP 5.5

来自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 $)表示的

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐