Hash Lab

Keyed cryptographic (MAC)

KMAC

Keccak Message Authentication Code, defined in NIST SP 800-185 (2016). Built directly on the SHA-3 sponge, KMAC absorbs the key as the first input block followed by the message and a length encoding. The result is a cleaner, single-pass construction than HMAC , no ipad/opad gymnastics needed because the sponge is not vulnerable to length-extension.

The two variants

VariantUnderlyingSecurity
KMAC128cSHAKE128128-bit
KMAC256cSHAKE256256-bit

Both produce variable-length output (you pick at call time), and both support optional customization strings for domain separation.

At a glance

ConstructioncSHAKE sponge with key prefix and length encoding
OutputVariable (XOF mode)
StandardNIST SP 800-185
Length extensionNo (sponge)
StatusModern; NIST-standardized

vs HMAC-SHA-3-256

HMAC over SHA-3-256 is double-the-sponge-work. KMAC256 achieves the same security with a single sponge pass, so it’s roughly twice as fast. New designs that already use SHA-3 should pick KMAC over HMAC-SHA-3 for that reason.

Where it is used

References

Quick quiz

Test yourself on kmac

10 multiple-choice questions. Pick an answer for each, then submit to see explanations.

  1. Q1.Which standard defines KMAC?

  2. Q2.KMAC is built on:

  3. Q3.KMAC variants:

  4. Q4.KMAC output length:

  5. Q5.vs HMAC-SHA-3-256:

  6. Q6.Customization strings in KMAC are used for:

  7. Q7.Is KMAC vulnerable to length-extension?

  8. Q8.KMAC is sister to which derived functions?

  9. Q9.Which library exposes KMAC most prominently?

  10. Q10.Year KMAC was standardized:

0 of 10 answered