1 public string CalculateMD5Hash(string input)
2 {
3 MD5 md5 = MD5.Create();
4 byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
5 byte[] hash = md5.ComputeHash(inputBytes);
6 StringBuilder sb = new StringBuilder();
7 for (int i = 0; i < hash.Length; i++) { sb.Append(hash[i].ToString("X2")); }
8 return sb.ToString();
9 }
来源:https://www.cnblogs.com/wz2988/p/12416513.html