HMACSHA1+Base64加密

public static string HMACSHA1(this string text, string secretKey)
{
HMACSHA1 hmacsha1 = new HMACSHA1();
hmacsha1.Key = Encoding.UTF8.GetBytes(secretKey);
byte[] dataBuffer = Encoding.UTF8.GetBytes(text);
byte[] hashBytes = hmacsha1.ComputeHash(dataBuffer);
var s = Convert.ToBase64String(hashBytes);
Convert.ToBase64CharArray(");
return s;
}

posted @ 2021-10-14 16:39  vba是最好的语言  阅读(368)  评论(0编辑  收藏  举报