1 #region MD5函数
2 ///
5 /// 原始字符串
6 ///
7 public static string MD5(string str)
8 {
9 byte[] b = encoding.GetBytes(str);
10 b = new System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(b);
11 string ret = "";
12 for (int i = 0; i < b.Length; i++)
13 {
14 ret += b[i].ToString("x").PadLeft(2, '0');
15 }
16 return ret;
17 }
18 #endregion
手机扫一扫
移动阅读更方便
你可能感兴趣的文章