public int CheckUser(string username, string password) { if (username != null) { byte[] salt = db.ufn_GetSalt(username); if (salt != null) { var hashedPassword = Hash.CreateHash(password, salt); int authenticated = db.AuthenticateUser(username, hashedPassword); return(authenticated); } else { return(0); } } else { return(0); } }