在比较密码之前,我必须做解密。我以前没有用过这个,谁能告诉我解密代码应该如何。谢谢在c中解密#
public string Encript(string password)
{
System.Security.Cryptography.MD5CryptoServiceProvider objCript =
new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] bs = System.Text.Encoding.UTF8.GetBytes(password);
bs = objCript.ComputeHash(bs);
System.Text.StringBuilder s = new System.Text.StringBuilder();
foreach (byte b in bs)
{
s.Append(b.ToString("x2").ToLower());
}
password = s.ToString();
return password;
}
你应该确保没有人能够访问这些数据库数据,并且你也使用了一些“salt”(请问一些Unix(或者它是Linux?)家伙) – Carsten
@CKoenig是的,这很重要,因为MD5是不是那么“单向”,因为它应该以这种简单形式:) – Matten