ערוך

שתף באמצעות


HMACSHA256 Constructors

Definition

Initializes a new instance of the HMACSHA256 class.

Overloads

HMACSHA256()

Initializes a new instance of the HMACSHA256 class with a randomly generated key.

HMACSHA256(Byte[])

Initializes a new instance of the HMACSHA256 class with the specified key data.

HMACSHA256()

Source:
HMACSHA256.cs
Source:
HMACSHA256.cs
Source:
HMACSHA256.cs

Initializes a new instance of the HMACSHA256 class with a randomly generated key.

public:
 HMACSHA256();
public HMACSHA256 ();
Public Sub New ()

Remarks

HMACSHA256 is a type of keyed hash algorithm that is constructed from the SHA-256 hash function and used as a Hash-based Message Authentication Code (HMAC). The HMAC process mixes a secret key with the message data, hashes the result with the hash function, mixes that hash value with the secret key again, and then applies the hash function a second time. The output hash is 256 bits in length.

This constructor uses a 64-byte, randomly generated key.

See also

Applies to

HMACSHA256(Byte[])

Source:
HMACSHA256.cs
Source:
HMACSHA256.cs
Source:
HMACSHA256.cs

Initializes a new instance of the HMACSHA256 class with the specified key data.

public:
 HMACSHA256(cli::array <System::Byte> ^ key);
public HMACSHA256 (byte[] key);
new System.Security.Cryptography.HMACSHA256 : byte[] -> System.Security.Cryptography.HMACSHA256
Public Sub New (key As Byte())

Parameters

key
Byte[]

The secret key for HMAC computation. 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 32-byte key.

Exceptions

The key parameter is null.

Examples

For an example of how to use this constructor, see the HMACSHA256 class.

Remarks

HMACSHA256 is a type of keyed hash algorithm that is constructed from the SHA-256 hash function and used as a Hash-based Message Authentication Code. The HMAC process mixes a secret key with the message data, hashes the result with the hash function, mixes that hash value with the secret key again, and then applies the hash function a second time. The output hash is 256 bits in length.

See also

Applies to