Exemplo n.º 1
0
 /// <summary>
 /// 哈希计算(使用BouncyCastle)
 /// </summary>
 public static byte[] Compute(string data, byte[] key)
 {
     return(HMAC.Compute(data, key, Algorithms.HMacSHA1));
     //or
     //return HMAC.Compute(data, key, new Sha1Digest());
 }
Exemplo n.º 2
0
 /// <summary>
 /// 生成密钥KEY
 /// </summary>
 /// <returns></returns>
 public static byte[] GeneratorKey()
 {
     return(HMAC.GeneratorKey(Algorithms.HMacSHA1));
 }