MD5 加密
MD5加密
1 public static string GetMD5(string str) { 2 //MD5进行加密 3 MD5 md5 = MD5.Create(); 4 byte[] buffer = Encoding.GetEncoding("GBK").GetBytes(str); 5 //返回一个加密好的字节数组 6 byte[] MD5Buffer = md5.ComputeHash(buffer); 7 //数组转换字符串 8 string stnew = ""; 9 for (int i = 0; i < MD5Buffer.Length; i++) 10 { 11 stnew += MD5Buffer[i].ToString("x2"); 12 } 13 return stnew; 14 15 }