`password_verify` call returning false for correct password

筅森魡賤 提交于 2019-12-01 23:20:17

It seems that you are running the script on a PHP version smaller than 5.3.7, and therefore the algorithm '2y' is not yet known.

If possible, i would consider to do a PHP upgrade on this server, the '2y' parameter solves a problem with unicode input strings.

Should this not be an option, then you can replace the algorithm in the compatibility pack. Somewhere about line 49 you will find...

$hash_format = sprintf("$2y$%02d$", $cost);

...change it to the former BCrypt constant '2a'...

$hash_format = sprintf("$2a$%02d$", $cost);

...this is of course not optimal, but it is the best you can do on earlier versions.

A new generated password hash will now start with '$2a$10$...' and the verification with this hash-value should work on every system.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!