我如何解密这种哈希加密类型,因为我不知道该方法或有解密码?解密散列
public string EncryptPassword(string password)
{
var bytes = new UTF8Encoding().GetBytes(password);
byte[] hashBytes;
using (var algorithm = new System.Security.Cryptography.SHA512Managed())
{
hashBytes = algorithm.ComputeHash(bytes);
}
return Convert.ToBase64String(hashBytes);
}
}
散列是单向转换。 – Nino
散列与加密不同。对于更简单的哈希算法,您可以尝试使用彩虹表进行暴力破解,但[可能不适用于SHA512](https://security.stackexchange.com/questions/44171/are-there-sha-512-rainbow-tables-available ) – stuartd
我怀疑你希望能够将密码发回给用户。在决定最好不要散列密码之前,请参阅[散列密码的最佳做法](http://stackoverflow.com/a/20186472/402022)和[通过电子邮件恢复/重置丢失的密码选项](http: //stackoverflow.com/a/13330223/402022)。 – Theraot