HMAC Output Calculator
Size an HMAC tag, check how your key is padded or hashed, and count the compression calls a verification costs.
Inputs
MAC Tag Size
32bytes
Hash Block Size
64bytes
Effective MAC Security
256bits
Compression Calls
12
Key Handling
Key zero-padded to the 64-byte block
Assessment
Strong — 256-bit MAC security
Step by step
Values used
Underlying hash = HMAC-SHA-256; Key length = 32 bytes; Message length = 512 bytes
HMAC Output
HMAC(K, m) = H((K ⊕ opad) ‖ H((K ⊕ ipad) ‖ m)); the tag is the full digest length and security = min(key bits, digest bits).
MAC Tag Size
= 32 bytes
Hash Block Size
= 64 bytes
Effective MAC Security
= 256 bits
Compression Calls
= 12
Key Handling
= Key zero-padded to the 64-byte block
Assessment
= Strong — 256-bit MAC security
How it works
HMAC pads the key to the hash block size, XORs it with two distinct constants, and runs the hash twice. That costs one extra block on each pass, so a short message still needs at least four compression calls, and a key longer than the block is hashed before use — extra key length beyond the block adds no strength. Truncating a tag or using a 12-byte key silently drops MAC security below the level your threat model assumes, and the compression count is what determines API signing throughput at scale.
Formula
HMAC Output
HMAC(K, m) = H((K ⊕ opad) ‖ H((K ⊕ ipad) ‖ m)); the tag is the full digest length and security = min(key bits, digest bits).
- ipad
- 0x36 repeated to the block size
- opad
- 0x5c repeated to the block size
- block size
- 64 bytes for SHA-1/224/256, 128 bytes for SHA-384/512
Frequently Asked Questions
How is HMAC Output calculated?
HMAC(K, m) = H((K ⊕ opad) ‖ H((K ⊕ ipad) ‖ m)); the tag is the full digest length and security = min(key bits, digest bits). HMAC pads the key to the hash block size, XORs it with two distinct constants, and runs the hash twice. That costs one extra block on each pass, so a short message still needs at least four compression calls, and a key longer than the block is hashed before use — extra key length beyond the block adds no strength.
Why does HMAC Output matter?
Truncating a tag or using a 12-byte key silently drops MAC security below the level your threat model assumes, and the compression count is what determines API signing throughput at scale.
What values do I need to enter?
This calculator takes 3 inputs: Underlying hash, Key length, Message length. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
Can I truncate an HMAC tag?
Yes — FIPS 198-1 allows truncation to the leftmost bytes, and RFC 4868 uses 128-bit truncated tags in IPsec. Security becomes the truncated length, so never go below 128 bits for a general-purpose MAC.