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

GetHMAC() private method

private GetHMAC ( HashAlgorithmName hashAlgorithm, byte key ) : HashAlgorithm
hashAlgorithm HashAlgorithmName
key byte
return HashAlgorithm
        private static HashAlgorithm GetHMAC(HashAlgorithmName hashAlgorithm, byte[] key)
        {
            if (hashAlgorithm == HashAlgorithmName.MD5)
                return new HMACMD5(key);
            if (hashAlgorithm == HashAlgorithmName.SHA1)
                return new HMACSHA1(key);
            if (hashAlgorithm == HashAlgorithmName.SHA256)
                return new HMACSHA256(key);
            if (hashAlgorithm == HashAlgorithmName.SHA384)
                return new HMACSHA384(key);
            if (hashAlgorithm == HashAlgorithmName.SHA512)
                return new HMACSHA512(key);

            throw new CryptographicException(NTE_BAD_ALGID);
        }