Aqueduct.Utils.HashService.VerifyHash C# (CSharp) Метод

VerifyHash() публичный Метод

Verifies if the hashValue is hashed form of plainText with given salt
public VerifyHash ( string plainText, string hashValue, string salt ) : bool
plainText string Plain text to be verified
hashValue string Hash value to be verified
salt string Salt that will be used in hashing
Результат bool
        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;
        }
    }