The 64 bytes are the same, but the == is returning false. I am guessing there may be something wrong with the encoding, but I can not figure out what I am doing wrong. Any ideas to fix this?
public static byte[] hashSHA512(string unhashedValue)
{
SHA512 shaM = new SHA512Managed();
byte[] hash = shaM.ComputeHash(Encoding.UTF8.GetBytes(unhashedValue));
return hash;
}
public static bool Validate(string enteredValue, byte[] hashedValue)
{
byte[] hash = hashSHA512 (enteredValue);
return (hash == hashedValue);
}
I tested this with a simple value and since they both call the same hash method I do not see how it can fail other than something in the encoding. I am just using the built in System.Security.Cryptography.