PHP password_needs_rehash() Function
PHP Password Hashing Algorithm
The password_hash() function is used to check whether the hash matches the specified options.
PHP version requirement: PHP 5 >= 5.5.0, PHP 7
Syntax
bool password_needs_rehash ( string $hash , int $algo [, array $options ] )
Parameter Description:
- hash: a hash created by password_hash().
- algo: a password algorithm constant used to indicate the algorithm when hashing the password.
- options: an associative array containing options. Currently two options are supported: salt, added when hashing the password (a disturbance string), and cost, used to indicate the recursion depth of the algorithm. Examples of these two values can be found on the crypt() page. If omitted, a random salt and the default cost will be used.
Return Value
This function checks whether the specified hash implements the provided algorithm and options. If not, the hash needs to be regenerated.