密码散列算法

属性
命名空间 fize\security
类名 Password
方法:
方法名 说明
getInfo() 返回指定散列(hash)的相关信息
hash() 创建密码的散列
needsRehash() 检测散列值是否匹配指定的选项
verify() 验证密码是否和散列值匹配

方法

getInfo()

返回指定散列(hash)的相关信息

public static function getInfo (
    string $hash
) : array
参数:
名称 说明
hash 指定散列

hash()

创建密码的散列

public static function hash (
    string $password,
    int $algo,
    array $options = null
) : string
参数:
名称 说明
password 密码
algo 指示算法的密码算法常量
options 选项
返回值:

失败时返回 false

needsRehash()

检测散列值是否匹配指定的选项

public static function needsRehash (
    string $hash,
    int $algo,
    array $options = null
) : bool
参数:
名称 说明
hash 散列值
algo 指示算法的密码算法常量
options 选项

verify()

验证密码是否和散列值匹配

public static function verify (
    string $password,
    string $hash
) : bool
参数:
名称 说明
password 密码
hash 散列值