首页 > 代码库 > c# MD5加密

c# MD5加密

 1         public static string GetMD5(string myString)
 2         {
 3             MD5 md5 = new MD5CryptoServiceProvider();
 4             byte[] fromData =http://www.mamicode.com/ System.Text.Encoding.Unicode.GetBytes(myString);
 5             byte[] targetData =http://www.mamicode.com/ md5.ComputeHash(fromData);
 6             string byte2String = null;
 7 
 8             for (int i = 0; i < targetData.Length; i++)
 9             {
10                 byte2String += targetData[i].ToString("x");
11             }
12 
13             return byte2String;
14         }

 

c# MD5加密