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() 时提供的选项。

实例

实例

<?php // 密码 $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://codercto.com/courses/l/5.html

查看所有标签

Parsing Techniques

Parsing Techniques

Dick Grune、Ceriel J.H. Jacobs / Springer / 2010-2-12 / USD 109.00

This second edition of Grune and Jacobs' brilliant work presents new developments and discoveries that have been made in the field. Parsing, also referred to as syntax analysis, has been and continues......一起来看看 《Parsing Techniques》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

随机密码生成器
随机密码生成器

多种字符组合密码