PHP password_get_info() 函数
PHP 教程
· 2019-01-31 22:56:39
password_get_info() 函数用于返回指定散列(hash)的相关信息。
PHP 版本要求: PHP 5 >= 5.5.0, PHP 7
语法
array password_get_info ( string $hash )
参数说明:
- $hash: 一个由 password_hash() 创建的散列值。
返回值
返回三个元素的关联数组:
- algo: 匹配密码算法的常量。
- algoName: 人类可读的算法名称。
- options: 调用 password_hash() 时提供的选项。
实例
实例
// 密码
$password_plaintext = "12345";
// 使用 password_hash() 创建散列值
$password_hash = password_hash( $password_plaintext, PASSWORD_DEFAULT, [ 'cost' => 11 ] );
// 查看信息
print_r( password_get_info( $password_hash ) );
输出结果为:
Array ( [algo] => 1 [algoName] => bcrypt [options] => Array ( [cost] => 11 ) )
点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html
Practical Algorithms for Programmers
Andrew Binstock、John Rex / Addison-Wesley Professional / 1995-06-29 / USD 39.99
Most algorithm books today are either academic textbooks or rehashes of the same tired set of algorithms. Practical Algorithms for Programmers is the first book to give complete code implementations o......一起来看看 《Practical Algorithms for Programmers》 这本书的介绍吧!