Beispiel #1
0
 /// <summary>
 /// MD5加密
 /// </summary>
 /// <param name="content">待加密内容</param>
 /// <param name="salt">加密盐,为null则只加密内容</param>
 /// <param name="type">密文编码类型</param>
 /// <returns></returns>
 public static string GetMd5Hash(string content, string salt, EncodeType type)
 {
     byte[] data = GetMd5Hash(content, salt);
     return(EncodingExt.GetString(data, type));
 }
Beispiel #2
0
 /// <summary>
 /// HMAC系列加密
 /// </summary>
 /// <typeparam name="T">继承HMAC的加密算法</typeparam>
 /// <param name="content">待加密内容</param>
 /// <param name="salt">加密盐</param>
 /// <param name="type">密文编码类型</param>
 /// <returns></returns>
 public static string GetHmacHash <T>(string content, string salt, EncodeType type) where T : HMAC, new()
 {
     byte[] data = GetHmacHash <T>(content, salt);
     return(EncodingExt.GetString(data, type));
 }