【13】MD5编码、Zlib压缩解压缩
1.MD5加密
1 /// <summary> 2 /// 使用MD5加密算法 3 /// </summary> 4 /// <param name="md5MessageStr">需要加密的字符串</param> 5 /// <returns>加密后返回字符串</returns> 6 public static string GetMD5String(string md5MessageStr) 7 { 8 using (MD5 md5 = new MD5CryptoServiceProvider()) 9 { 10 byte[] convertValue = Encoding.UTF8.GetBytes(md5MessageStr); 11 byte[] resultValue = md5.ComputeHash(convertValue); 12 string strResult = string.Empty; 13 for (int i = 0; i < 16; i++) 14 { 15 strResult += resultValue[i].ToString("x2"); 16 } 17 return strResult; 18 } 19 }
2.Zlib压缩解压缩
nuget获取zlib.net