开发者

the best implementation of RFC 2104 HMAC-SHA1

开发者 https://www.devze.com 2023-02-04 03:12 出处:网络
What is the best implementation of RFC 2104 HMAC-SHA1 alg. in php? I have read http://us2.php.net/man开发者_开发问答ual/en/function.hash-hmac.php but when I try them I get

What is the best implementation of RFC 2104 HMAC-SHA1 alg. in php? I have read http://us2.php.net/man开发者_开发问答ual/en/function.hash-hmac.php but when I try them I get

different results.

Thank's


Just use the function you linked.

hash_hmac("sha1", $message, $key);

$message and $key are the strings provided by you.


The hash extension is definitely the best option you have in PHP. hash() and specifically hash_hmac() as you pointed out are both supporting SHA1 and both do a good job of it.

0

精彩评论

暂无评论...
验证码 换一张
取 消