asp.net 2.0中md5密码加密
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
}
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
}


浙公网安备 33010602011771号