md5加密
using System; using System.Collections.Generic; using System.Security.Cryptography; using System.Text; namespace ConsoleApplication2 { class Program { /// <summary> /// md5加密 /// </summary> /// <param name="args"></param> static void Main(string[] args) { string str = "", str1 = "admin"; MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); byte[] byets = System.Text.Encoding.UTF8.GetBytes(str1); byets = md5.ComputeHash(byets); for (int i = 0; i < byets.Length; i++) { // x2 代表转换为16进制 大写X 代表把字母转成大写 str += byets[i].ToString("x2"); } Console.WriteLine(str); Console.ReadKey(); } } }