函数名:sodium_crypto_shorthash()
适用版本:PHP 7.2.0及以上
用法:sodium_crypto_shorthash()函数用于生成短哈希值。它使用SipHash-2-4算法,将输入消息和密钥作为参数,生成一个64位的短哈希值。
语法:sodium_crypto_shorthash(string $message, string $key): string
参数:
返回值:生成的64位短哈希值,类型为字符串。
示例:
$message = "Hello, World!";
$key = "secretpassword";
$hash = sodium_crypto_shorthash($message, $key);
echo "短哈希值: " . bin2hex($hash);
输出:
短哈希值: 7263d1f2c92b1c4c
注意事项: