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

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

WBOY
Release: 2016-06-06 20:15:52
Original
1094 people have browsed it

密码生成时:

<code>password_hash($this->input->post('pass'),PASSWORD_BCRYPT)</code>
Copy after login
Copy after login

密码验证时:

<code>password_verify($password,$pass);
</code>
Copy after login
Copy after login

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

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

问题在哪里?

回复内容:

密码生成时:

<code>password_hash($this->input->post('pass'),PASSWORD_BCRYPT)</code>
Copy after login
Copy after login

密码验证时:

<code>password_verify($password,$pass);
</code>
Copy after login
Copy after login

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

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

问题在哪里?

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

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template