crypt_checksalt
(PECL xpass >= 1.1.0)
crypt_checksalt — Validate a crypt setting string
说明
Checks the salt string against the system configuration and reports whether the hashing method and parameters it specifies are acceptable. It is intended to be used to determine whether the user's passphrase should be re-hashed using the currently preferred hashing method.
参数
salt
- Salt string to check.
返回值
Returns one of the
CRYPT_SALT_*
as an int.
示例
示例 #1 A crypt_checksalt() example
<?php
// Generate a salt for a legacy method
$salt = crypt_gensalt(CRYPT_PREFIX_STD_DES);
// Check the salt
$test = crypt_checksalt($salt);
var_dump($test === CRYPT_SALT_METHOD_LEGACY);
// Generate a salt for default method
$salt = crypt_gensalt();
// Check the salt
$test = crypt_checksalt($salt);
var_dump($test === CRYPT_SALT_OK);
?>
以上示例会输出:
bool(true) bool(true)
参见
- crypt_gensalt() - Compile a string for use as the salt argument to crypt
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。
备份地址:http://www.lvesu.com/blog/php/function.crypt-checksalt.php