← Interactive API Explorer
Namespace: System.Security.Cryptography

HMACSHA256

Computes a Hash-based Message Authentication Code (HMAC) by using the SHA256 hash function.

Methods (1)

HMACSHA256(Byte[])Constructor
Initializes a new instance of the HMACSHA256 class with the specified key data.
ParameterDescription
keyThe secret key for HMACSHA256 encryption. The key can be any length. However, the recommended size is 64 bytes. If the key is more than 64 bytes long, it is hashed (using SHA-256) to derive a 64-byte key. If it is less than 64 bytes long, it is padded to 64 bytes.