System.Security.Cryptography.IncrementalHash.GetHashAlgorithm C# (CSharp) Method

GetHashAlgorithm() private method

private GetHashAlgorithm ( HashAlgorithmName hashAlgorithm ) : HashAlgorithm
hashAlgorithm HashAlgorithmName
return HashAlgorithm
        private static HashAlgorithm GetHashAlgorithm(HashAlgorithmName hashAlgorithm)
        {
            if (hashAlgorithm == HashAlgorithmName.MD5)
                return new MD5CryptoServiceProvider();
            if (hashAlgorithm == HashAlgorithmName.SHA1)
                return new SHA1CryptoServiceProvider();
            if (hashAlgorithm == HashAlgorithmName.SHA256)
                return new SHA256CryptoServiceProvider();
            if (hashAlgorithm == HashAlgorithmName.SHA384)
                return new SHA384CryptoServiceProvider();
            if (hashAlgorithm == HashAlgorithmName.SHA512)
                return new SHA512CryptoServiceProvider();

            throw new CryptographicException(NTE_BAD_ALGID);
        }