我已经使用下面的代码创建了密码的哈希值..我存储从下面的方法返回的值。从哈希值获取密码的字符串值
public static string CreateHash(string password)
{
// Generate a random salt
RNGCryptoServiceProvider csprng = new RNGCryptoServiceProvider();
byte[] salt = new byte[24];
csprng.GetBytes(salt);
HashAlgorithm hashAlg = new SHA256CryptoServiceProvider();
byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(salt + ":" + password);
// Hash the password and encode the parameters
byte[] bytHash = hashAlg.ComputeHash(bytValue);
return
Convert.ToBase64String(bytHash);
}
现在我想在上面创建哈希值进行解码.. 我需要密码的字符串值。如何做呢..?
你不能,散列是单向算法。 – MvdD
此外,能够检索密码的原始值几乎总是一个坏主意。无论你想要实现什么,都可以以更好更安全的方式完成。 – Rob
是否有任何其他算法是2种方式,以便我可以将其用于我的逻辑 – axn7975