I've seen questions stating the same hash is generated, but with the following code:
var password = "TestPassword";
using (var hash = new SHA1CryptoServiceProvider())
{
var hashBytes = hash.ComputeHash(Encoding.UTF8.GetBytes(password));
Console.WriteLine( Convert.ToBase64String(hashBytes) );
}
using (var managed = new SHA256Managed())
{
var hashBytes = managed.ComputeHash(Encoding.UTF8.GetBytes(password));
Console.WriteLine(Convert.ToBase64String(hashBytes));
}
The output is:
YlBiWyJt9ihwriOvjT+sB2DXFYg=
e8+diSmPG/rhb6Au1rYZCP0vqN5F3Y4hU6PEcwB2Uyg=
Am I not using the crypto libraries correctly?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…