static public class HashFunctions { public static Byte[] GetHashValue(string s) { byte[] source = ASCIIEncoding.ASCII.GetBytes(s); return new MD5CryptoServiceProvider().ComputeHash(source); } public static bool CompareHash(byte[] first, byte[] second) { bool equal = false; if (first.Length == second.Length) { int i=0; while (i < first.Length && (first[i] == second[i])) i++; equal = i == first.Length; } return equal; } public static bool CompareHash(byte[] b,string s) { return CompareHash(b, GetHashValue(s)); } }The password is stored as a byte array (varbinary() in MSSQL)