貌似很纯洁 发表于 2017-10-16 09:56:21

求erlang中hmac sha1加密算法

求erlang中hmac sha1加密算法,最好有源代码或者思路

dreamxyp 发表于 2017-10-17 11:54:51

把c 的代码 找出来用erlang 抄一次

不过有现成的crypto:start().

<<Mac:160/integer>> = crypto:hmac(sha, <<"hello">>, <<"world">>).
<<138,58,132,188,208,208,6,94,151,241,117,211,112,68,124,
125,2,224,9,115>>
lists:flatten(io_lib:format("~40.16.0b", )).
"8a3a84bcd0d0065e97f175d370447c7d02e00973"

tianzhiwu 发表于 2022-8-16 19:39:55

http_uri:encode(binary_to_list(base64:encode(crypto:hmac('sha', Key, BaseStr))))

tianzhiwu 发表于 2022-8-24 12:13:30

erlang24或以上版本 用这个crypto:mac(hmac, 'sha', Key, BaseStr)
页: [1]
查看完整版本: 求erlang中hmac sha1加密算法