Hkdf..::..Extract Method (HashAlgorithmName, array<Byte>[]()[][], array<Nullable<(Of <(<'Byte>)>)>>[]()[][])

Extracts a pseudorandom key from the provided input key material using an optional salt value.

Namespace:  SecretNET.Crypto
Assembly:  SecretNET (in SecretNET.dll)

Syntax


public static byte[] Extract(
	HashAlgorithmName hashAlgorithmName,
	byte[] ikm,
	Nullable<byte>[] salt
)

Parameters

hashAlgorithmName
Type: HashAlgorithmName
The hash algorithm to be used by the HMAC primitive. Supported hash functions: MD5, SHA1, SHA256, SHA384, SHA512.
ikm
Type: array<Byte>[]()[][]
The input key material.
salt
Type: array<Nullable<(Of <(<'Byte>)>)>>[]()[][]
The optional salt value. If the argument is omitted or its value is set to null, the extraction is performed without salt.

Return Value

The pseudorandom key of the size of hash algorithm output, i.e.: MD5 - 16 bytes, SHA1 - 20 bytes, SHA256 - 32 bytes, SHA384 - 48 bytes, SHA512 - 64 bytes.

Exceptions


ExceptionCondition
[ArgumentNullException]The argument ikm is null.
[ArgumentOutOfRangeException]The hash algorithm specified in the parameter hashAlgorithmName is not supported.