using System.Security.Cryptography; [STAThread] static void Main(string[] args) { string Text = "[123 & abc & 中文]"; Console.WriteLine(Encrypt(Text)); // CE-AE-F1-DC-EB-F7-0F-16-E5-16-4A-A8-E4-48-EB-C3 } /// /// 加密 /// /// /// public static string Encrypt(string data) { Byte[] clearBytes = System.Text.Encoding.Unicode.GetBytes(data); Byte[] hashedBytes = ((HashAlgorithm) CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes); return BitConverter.ToString(hashedBytes); }
0 Responses to MD5加密
Something to say?