1
using
System.Text;
2 using System.Security.Cryptography;
3
4 // 密码加密
5 public static string Encrypt( string password)
6 {
7 password = password.ToLower();
8
9 Byte[] clearBytes = new UnicodeEncoding().GetBytes(password);
10 Byte[] hashedBytes = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
11
12 return BitConverter.ToString(hashedBytes);
13}
2 using System.Security.Cryptography;
3
4 // 密码加密
5 public static string Encrypt( string password)
6 {
7 password = password.ToLower();
8
9 Byte[] clearBytes = new UnicodeEncoding().GetBytes(password);
10 Byte[] hashedBytes = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
11
12 return BitConverter.ToString(hashedBytes);
13}