I am making a login page and i saved the user's details and hashed password in the CUSTOMERS table, but i cant send the salt and the typed password i get from the database and the user to my method
var UserInput = db.CUSTOMERs.Where(b => b.EMAIL == cUSTOMER.EMAIL && b.PASSWORD == sha256(b.SALT+cUSTOMER.PASSWORD).ToString()).FirstOrDefault() ;
Hash method
static string sha256(string password)
{
System.Security.Cryptography.SHA256Managed crypt = new System.Security.Cryptography.SHA256Managed();
System.Text.StringBuilder hash = new System.Text.StringBuilder();
byte[] crypto = crypt.ComputeHash(Encoding.UTF8.GetBytes(password), 0, Encoding.UTF8.GetByteCount(password));
foreach (byte theByte in crypto)
{
hash.Append(theByte.ToString("x2"));
}
return hash.ToString();
}