public static string ComputeHmacSha512(string plainText, string secretKey) {
using (var hmac = new HMACSHA512(Encoding.UTF8.GetBytes(secretKey)))
{
byte[] hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(plainText));
return Convert.ToBase64String(hash);
}
}
|
|