HMAC (Keyed-Hash Nachricht Authentication) Referenz
Referenz für HMAC construction, Sicherheit Eigenschaften, und usage guidelines per RFC 2104.
Construction
HMAC nests the hash function with key XOR inner/outer pad constants. The key is padded to the hash block size (or hashed first if longer). The inner hash processes the padded key and message; the outer hash processes the padded key and inner result. This construction is provably secure as long as the underlying hash is a pseudorandom function. The ipad and opad constants are 0x36 and 0x5C repeated.
- ipad
- Inner pad constant
- opad
- Outer pad constant
- key padding
- Zero-pad or hash
0x36 repeated 0x5C repeated block size Security and Usage
HMAC security is bounded by the minimum of the hash output size and half the hash output size for collision resistance. HMAC is not affected by length extension attacks unlike raw Merkle-Damgard hashes. Verification must use constant-time comparison to prevent timing attacks. HMAC is used in TLS record protection, JWT signatures, and IPsec. The hash function can be replaced without changing the HMAC interface.
- security bound
- min(output, output/2)
- length extension
- Immune
- constant-time
- Required for verify
collision resistance nested construction prevent timing