以下是使用JS实现SHA1算法,我找了许多C#的代码,SHA1算法都没有“密码”和“密钥”同时实现的,请各位大哥帮忙。
function getMacSha1Code(pwd){
var bytes = Crypto.charenc.Binary.stringToBytes("123456");
var hmac = Crypto.HMAC(Crypto.SHA1,pwd,bytes, { asBytes: true });
var base64 = Crypto.util.bytesToBase64(hmac);
return  base64;
}