I'm using .net 3.5. The problem here is that I cant seem to get the passwords to match. I have tried using the ComputeHash method on both, but it generates a different hash. As they are now the arrays are different sizes. (Obviously they are based on the same string). What have I done wrong? ("password" is byte[] param by user input)
object dataPassword = database.ExecuteScalar("GetUserPassword", new object[] {userName});
if(dataPassword != null && !(dataPassword is DBNull))
{
SHA1Managed hashProvider = new SHA1Managed();
byte[] hashedPassword = (byte[])dataPassword;
byte[] hash = hashProvider.ComputeHash(password);
result = hashedPassword.Equals(hash);
}