///
/// 签名计算方法
///
///
///
///
public static string hash_hmac2(string message, string secret)
{
secret = secret ?? “”;
var encoding = new System.Text.ASCIIEncoding();
byte[] keyByte = encoding.GetBytes(secret);
byte[] messageBytes = encoding.GetBytes(message);
using (var hmacsha256 = new HMACSHA256(keyByte))
{
byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
return Convert.ToBase64String(hashmessage);
}
}
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/204889.html原文链接:https://javaforall.net
