C#NET获取CalculateMD5Hash32位

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         }

 

C#NET获取CalculateMD5Hash32位

上一篇:《深入理解 C# (第2版)》 - 学习笔记


下一篇:C#NET获取IP地址的方法