English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Hashing Password Algorithm
The password_get_info() function is used to return information about the specified hash (hash).
PHP version requirement: PHP 5 >= 5.5.0, PHP 7
array password_get_info(string $hash)
Parameter description:
$hash: An array by password_hash() The created hash value.
Returns an associative array of three elements:
algo: Constant matching the password algorithm.
algoName: Human-readable algorithm name.
options: Options provided when calling password_hash().
<?php // Password $password_plaintext = "12345"; // Use password_hash() to create a hash value $password_hash = password_hash($password_plaintext, PASSWORD_DEFAULT, ['cost' => 11]); // View information print_r(password_get_info($password_hash));
The output result is:
Array ( [algo] => 1 [algoName] => bcrypt [options] => Array ( [cost] => 11 ) )