C# 常用方法——32位MD5加密
其他常用方法详见:https://www.cnblogs.com/zhuanjiao/p/12060937.html
/// <summary> /// 32位MD5加密(小写) /// </summary> /// <param name="input">输入字段</param> /// <returns></returns> public string Encrypt(string str) { MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider(); byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(str)); StringBuilder sBuilder = new StringBuilder(); for (int i = 0; i < data.Length; i++) { sBuilder.Append(data[i].ToString("x2"));//转化为小写的16进制 } return sBuilder.ToString(); }