HMAC-MD5
The standard way to build a MAC from a cryptographic hash (RFC 2104, FIPS 198-1)
Old but not broken. Kept for interoperability; root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About HMAC-MD5
HMAC-MD5 is one of 8 HMAC variants in the NextSSL registry, a message authentication code. It uses a 1–268,435,456-byte key and a 16-byte authentication tag. Its registry entry cites RFC 2104 and RFC 2202. NextSSL lists it in the legacy tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
HMAC is a message authentication code built from a cryptographic hash function and a secret key. It is the most widely deployed MAC, used in TLS, IPsec, JWT, TOTP and countless APIs, and is the basis of HKDF and PBKDF2.
HMAC computes H((K ⊕ opad) ‖ H((K ⊕ ipad) ‖ m)), where K is the key padded to the hash block size and ipad and opad are fixed byte patterns. The nested structure means HMAC remains secure even when the underlying hash is vulnerable to length-extension, and its security proof requires only that the hash's compression function behaves as a pseudo-random function, a weaker property than collision resistance.
NextSSL provides a generic HMAC over its hash functions and named instances HMAC-MD5, HMAC-SHA1, HMAC-SHA256, HMAC-SHA512 and HMAC-SHA3-256/384/512. HMAC was introduced by Mihir Bellare, Ran Canetti and Hugo Krawczyk in 1996, specified in RFC 2104 and standardised by NIST in FIPS 198-1; RFC 4231 gives SHA-2 test vectors and NIST SP 800-224 covers HMAC with SHA-3.
History
1996–2008HMAC published by Bellare, Canetti and Krawczyk
Specified in RFC 2104
Specified in RFC 2202
Standardised in FIPS 198
Specified in RFC 4231
FIPS 198-1 published
How it works
- Pad or hash the key to the block size
- Hash (key XOR ipad) followed by the message
- Hash (key XOR opad) followed by the inner digest
- Output the outer digest, optionally truncated
Security notes
HMAC with SHA-2 or SHA-3 has no known practical weaknesses. HMAC-MD5 and HMAC-SHA1 are not practically broken as MACs because they do not depend on collision resistance, but they are deprecated and should be replaced. Tags must be compared in constant time to avoid timing leaks.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 1 – 268,435,456 | Secret key |
| tag | 16 – 16 | Authentication tag |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'legacy' is reachable from the root API only
key = root.random(1)
tag = root.call("mac", "hmac-md5", None, key, b"message", 0)[0]
ok = root.check("mac_verify", "hmac-md5", None, key, b"message", tag)
nextssl_root_mac("hmac-md5", NULL, key, data, 0, tag);
nextssl_root_mac_verify("hmac-md5", NULL, key, data, tag);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_mac_in(reg::all(), Policy::Any, "hmac-md5", &Params::new())?;
let tag = alg.tag(&key, b"message")?;
let ok = alg.verify(&key, b"message", &tag)?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Other HMAC variants
7Similar names
Looking for something else?More message authentication codes
All 30Frequently asked questions
What is HMAC-MD5?
HMAC-MD5 is a MAC in the HMAC family. HMAC is a message authentication code built from a cryptographic hash function and a secret key.
What are the HMAC-MD5 sizes?
In NextSSL, HMAC-MD5 uses: key 1 to 268,435,456 bytes, tag 16 to 16 bytes.
Who designed HMAC-MD5 and when?
HMAC-MD5 belongs to the HMAC family, first published in 1996 by Mihir Bellare, Ran Canetti, Hugo Krawczyk. Its origin: RFC 2104; FIPS 198-1.
Which standards define HMAC-MD5?
HMAC-MD5 is referenced by RFC 2104, RFC 2202.
Is HMAC-MD5 safe to use?
HMAC-MD5 is in the legacy tier. Old but not broken. Kept for interoperability; root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).
What other HMAC variants are there?
NextSSL also registers hmac, hmac-sha1, hmac-sha256, hmac-sha3-256, hmac-sha3-384, hmac-sha3-512 and more in the HMAC family.
Related families
The NIST Merkle–Damgård hash family behind most of today's TLS, signatures and software
SHA-3 and KeccakThe Keccak sponge, standardised by NIST in FIPS 202 as a structural alternative to SHA-2
HKDFHMAC-based extract-and-expand key derivation function (RFC 5869)
KMACNIST's Keccak-based MAC from SP 800-185, with optional arbitrary-length output
PBKDF2The iterated-HMAC password-based key derivation function from PKCS #5 and NIST SP 800-132
SHA-3 and KeccakThe Keccak sponge, standardised by NIST in FIPS 202 as a structural alternative to SHA-2