public static string Encrypt(string txt) { System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] bytes = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(txt)); return BitConverter.ToString(bytes).Replace("-", ""); } public static string Encrypt2(string txt) { System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] bytes = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(txt)); StringBuilder sb = new StringBuilder(); foreach(byte b in bytes) { sb.Append(b.ToString("X").PadLeft(2,'0')); } return sb.ToString(); }