Home  >  Article  >  Backend Development  >  php_hash()生成的密码,隔一段时间后验证失效

php_hash()生成的密码,隔一段时间后验证失效

WBOY
WBOYOriginal
2016-06-06 20:15:52951browse

密码生成时:

password_hash($this->input->post('pass'),PASSWORD_BCRYPT)

密码验证时:

password_verify($password,$pass);

$pass 是从数据库取出来的,$password 是用户输入的。

经常过一段时间之后,验证总是 FALSE。非常确定没有修改密码。

问题在哪里?

回复内容:

密码生成时:

password_hash($this->input->post('pass'),PASSWORD_BCRYPT)

密码验证时:

password_verify($password,$pass);

$pass 是从数据库取出来的,$password 是用户输入的。

经常过一段时间之后,验证总是 FALSE。非常确定没有修改密码。

问题在哪里?

生成密码散列的时候建议使用如下password_hash($password, PASSWORD_DEFAULT);

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn