函数名称:sodium_crypto_pwhash_scryptsalsa208sha256_str()
适用版本:PHP 7.2.0及以上版本
函数说明:sodium_crypto_pwhash_scryptsalsa208sha256_str()函数用于生成基于scryptsalsa208sha256算法的密码哈希字符串。
用法: string sodium_crypto_pwhash_scryptsalsa208sha256_str( int $password, int $opslimit, int $memlimit )
参数:
返回值: 返回一个包含密码哈希的字符串,长度为64个字符。
示例:
$password = "myPassword123";
$opslimit = SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE;
$memlimit = SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE;
$hash = sodium_crypto_pwhash_scryptsalsa208sha256_str($password, $opslimit, $memlimit);
echo "Password hash: " . $hash;
注意事项: