IncrementalHash.CreateHMAC(HashAlgorithmName, Byte[]) IncrementalHash.CreateHMAC(HashAlgorithmName, Byte[]) IncrementalHash.CreateHMAC(HashAlgorithmName, Byte[]) IncrementalHash.CreateHMAC(HashAlgorithmName, Byte[]) Method

Definition

Creates an IncrementalHash for the Hash-based Message Authentication Code (HMAC) algorithm using the specified hash algorithm and key.

public:
 static System::Security::Cryptography::IncrementalHash ^ CreateHMAC(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, cli::array <System::Byte> ^ key);
public static System.Security.Cryptography.IncrementalHash CreateHMAC (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[] key);
static member CreateHMAC : System.Security.Cryptography.HashAlgorithmName * byte[] -> System.Security.Cryptography.IncrementalHash
Public Shared Function CreateHMAC (hashAlgorithm As HashAlgorithmName, key As Byte()) As IncrementalHash

Parameters

hashAlgorithm
HashAlgorithmName HashAlgorithmName HashAlgorithmName HashAlgorithmName

The name of the hash algorithm to perform within the HMAC.

key
Byte[]

The secret key for the HMAC. The key can be of any length, but a key longer than the output size of the specified hash algorithm will be hashed to derive a correctly-sized key. Therefore, the recommended size of the secret key is the output size of the specified hash algorithm.

Returns

An instance of the IncrementalHash class ready to compute the specified hash algorithm.

Exceptions

hashAlgorithm.Name is null or an empty string.

Applies to