public bool VerifyHash(string plainText, string hashValue, string salt) { byte[] hashWithSaltBytes = Convert.FromBase64String(hashValue); int hashSizeInBits = hashAlgorithm.HashSize; int hashSizeInBytes = hashSizeInBits/8; if (hashWithSaltBytes.Length < hashSizeInBytes) return false; string expectedHashString = ComputeHash(plainText, salt); return hashValue == expectedHashString; } }