Class HmacSha3_256
- Namespace
- CryptoHives.Foundation.Security.Cryptography.Mac
- Assembly
- CryptoHives.Foundation.Security.Cryptography.dll
Computes the HMAC-SHA3-256 message authentication code.
public sealed class HmacSha3_256 : HmacCore, IMac, IDisposable
- Inheritance
-
HmacSha3_256
- Implements
- Inherited Members
Remarks
This is a fully managed implementation of HMAC-SHA3-256 as defined in RFC 2104, using the CryptoHives SHA3-256 implementation based on the Keccak sponge construction. It does not rely on OS or hardware cryptographic APIs, ensuring deterministic behavior across all platforms.
HMAC-SHA3-256 produces a 256-bit (32-byte) authentication tag.
While SHA-3 already provides keyed hashing via KMAC, HMAC-SHA3 is useful for protocol compatibility with systems that standardize on the HMAC construction.
Constructors
HmacSha3_256(byte[])
Initializes a new instance of the HmacSha3_256 class.
public HmacSha3_256(byte[] key)
Parameters
keybyte[]The secret key.
Fields
MacSizeBits
The MAC output size in bits.
public const int MacSizeBits = 256
Field Value
MacSizeBytes
The MAC output size in bytes.
public const int MacSizeBytes = 32
Field Value
Methods
Create(byte[])
Creates a new instance of the HmacSha3_256 class.
public static HmacSha3_256 Create(byte[] key)
Parameters
keybyte[]The secret key.
Returns
- HmacSha3_256
A new HMAC-SHA3-256 instance.
Hash(byte[], byte[])
Computes the HMAC-SHA3-256 tag for the specified key and data in a single operation.
public static byte[] Hash(byte[] key, byte[] data)
Parameters
Returns
- byte[]
The 32-byte MAC tag.