为了保证数据库密码安全,或者其他,需要加密一些东西
using System.Security.Cryptography;
static string GetMD5(string str) { MD5 md5 = MD5.Create(); byte[] buffer = Encoding.Default.GetBytes(str); byte[] bufferMd5 = md5.ComputeHash(buffer); StringBuilder sb = new StringBuilder(); for (int i = 0; i < bufferMd5.Length; i++) { sb.Append(bufferMd5[i].ToString("x2")); } return sb.ToString(); }