C# .net core 使用HMAC-SHA1

两篇文章:

using System;
using System.Text;
using System.Security.Cryptography;
...
string text;
string key;
...
...
var byteData = Encoding.UTF8.GetBytes(text);
var byteKey = Encoding.UTF8.GetBytes(key);
HMACSHA1 hmac = new HMACSHA1(byteKey);
var res =Convert.ToBase64String(hmac.ComputeHash(byteData));