从哈希值中获取密码的字符串值
get string value of password from hash value
我使用以下代码为密码创建了一个哈希值。我正在存储从以下方法返回的值。
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);
}
现在我想解码上面创建的哈希值..
我需要密码的字符串值..我该怎么做..?
SHA-256 是一种单向哈希算法。除非暴力猜测,否则无法从哈希中获取原始文本。
我使用以下代码为密码创建了一个哈希值。我正在存储从以下方法返回的值。
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);
}
现在我想解码上面创建的哈希值.. 我需要密码的字符串值..我该怎么做..?
SHA-256 是一种单向哈希算法。除非暴力猜测,否则无法从哈希中获取原始文本。