using System; using System.Collections.Generic; using System.Security.Cryptography; using System.Text; namespace Bowin.Common.HmacSHA1 { public class HMACSHA1Encoder { public static string Encode(string key, string text) { var keyByte = Encoding.UTF8.GetBytes(key); var textByte = Encoding.UTF8.GetBytes(text); HMACSHA1 hmac = new HMACSHA1(keyByte); hmac.Initialize(); return Convert.ToBase64String(hmac.ComputeHash(textByte)); } } }