- //第一种加密
- string str = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("密码", "MD5");
- //第二种加密
- //引入命名空间
- using System.Text;
- using System.Security.Cryptography;
- MD5 md5 = MD5CryptoServiceProvider.Create();
- byte[] data = Encoding.UTF8.GetBytes("密码");
- byte[] newdata = md5.ComputeHash(data);
- string str = BitConverter.ToString(newdata);