Class HmacMd5
- Namespace
- CryptoHives.Foundation.Security.Cryptography.Mac
- Assembly
- CryptoHives.Foundation.Security.Cryptography.dll
Computes the HMAC-MD5 message authentication code.
[Obsolete("HMAC-MD5 is provided for legacy compatibility. Prefer HmacSha256 or stronger.")]
public sealed class HmacMd5 : HmacCore, IMac, IDisposable
- Inheritance
-
HmacMd5
- Implements
- Inherited Members
Remarks
This is a fully managed implementation of HMAC-MD5 as defined in RFC 2104, using the CryptoHives MD5 implementation. It does not rely on OS or hardware cryptographic APIs, ensuring deterministic behavior across all platforms.
HMAC-MD5 produces a 128-bit (16-byte) authentication tag.
Security warning: MD5 is considered cryptographically broken. While HMAC-MD5 is still considered secure for authentication in some contexts, prefer HMAC-SHA-256 or stronger variants for new applications.
Constructors
HmacMd5(byte[])
Initializes a new instance of the HmacMd5 class.
public HmacMd5(byte[] key)
Parameters
keybyte[]The secret key.
Fields
MacSizeBits
The MAC output size in bits.
public const int MacSizeBits = 128
Field Value
MacSizeBytes
The MAC output size in bytes.
public const int MacSizeBytes = 16
Field Value
Methods
Create(byte[])
Creates a new instance of the HmacMd5 class.
public static HmacMd5 Create(byte[] key)
Parameters
keybyte[]The secret key.
Returns
- HmacMd5
A new HMAC-MD5 instance.
Hash(byte[], byte[])
Computes the HMAC-MD5 tag for the specified key and data in a single operation.
public static byte[] Hash(byte[] key, byte[] data)
Parameters
Returns
- byte[]
The 16-byte MAC tag.