弘扬国学 · 传承文化
查询

hash_hmac_algos()函数—用法及示例

「 返回当前系统支持的所有哈希算法的名称,这些算法可以用于 hash_hmac() 函数进行消息认证码计算 」


函数名:hash_hmac_algos()

适用版本:PHP 5 >= 5.1.2, PHP 7, PHP 8

用法:hash_hmac_algos() 函数返回当前系统支持的所有哈希算法的名称,这些算法可以用于 hash_hmac() 函数进行消息认证码计算。

语法:hash_hmac_algos(): array

示例:

<?php
// 获取系统支持的哈希算法
$algos = hash_hmac_algos();

// 打印支持的算法列表
foreach ($algos as $algo) {
    echo $algo . PHP_EOL;
}
?>

输出:

md2
md4
md5
sha1
sha224
sha256
sha384
sha512
ripemd128
ripemd160
ripemd256
ripemd320
whirlpool
tiger128,3
tiger160,3
tiger192,3
tiger128,4
tiger160,4
tiger192,4
snefru
gost
adler32
crc32
crc32b
salsa10
salsa20
haval128,3
haval160,3
haval192,3
haval224,3
haval256,3
haval128,4
haval160,4
haval192,4
haval224,4
haval256,4
haval128,5
haval160,5
haval192,5
haval224,5
haval256,5

注意:具体支持的算法列表可能因PHP版本和系统环境而有所不同。

补充纠错
上一个函数: hash_hmac_file()函数
下一个函数: hash_hkdf()函数
热门PHP函数
分享链接