English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Password Hashing Algorithm
The password_verify() function is used to verify whether the password matches the hash value.
PHP Version Requirement: PHP 5 >= 5.5.0, PHP 7
bool password_verify ( string $password , string $hash )
Parameter Description:
password: The user's password.
hash: An instance of password_hash() The created hash value.
Returns TRUE if the password matches the hash value, otherwise returns FALSE.
<?php // If you want to know where the following characters come from, see the example of password_hash(). $hash = '$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq'; if (password_verify('rasmuslerdorf', $hash)) { echo 'Password is valid!'; } else { echo 'Invalid password.'; } ?>
The output is:
Password is valid!