MAC family

KMAC

NIST's Keccak-based MAC from SP 800-185, with optional arbitrary-length output

standard 4 variants NIST SP 800-185

Overview

KMAC is a keyed message authentication code defined by NIST in SP 800-185, built directly on cSHAKE. Because the Keccak sponge is not vulnerable to length-extension, KMAC needs only a single pass over the key and message rather than HMAC's nested structure.

KMAC prefixes the encoded key, padded to the sponge rate, to the message, appends the requested output length, and hashes the result with cSHAKE using the function name "KMAC" and an optional customisation string for domain separation. Because the output length is part of the input, requesting a different length produces an unrelated tag rather than a prefix.

NextSSL includes KMAC128 and KMAC256, based on cSHAKE128 and cSHAKE256, and their XOF variants KMACXOF128 and KMACXOF256, which encode the output length as zero so that arbitrary-length output can be read as a stream. KMAC is simpler and often faster than HMAC-SHA3, since the key is processed once in a padded prefix block and no outer hash is needed. It can also serve as a key derivation function, as NIST SP 800-108 allows.

History

2016–2016
  1. Specified in NIST SP 800-185

Security notes

KMAC inherits its security from Keccak, with no known weaknesses. The key should be at least as long as the target security level: 128 bits for KMAC128 and 256 bits for KMAC256.

Typical uses

Message authentication in SHA-3-based systemsKeyed pseudo-random function and key derivationDomain-separated MACs via customisation strings

Variants in NextSSL

4
AlgorithmTierSizes (bytes)StandardsAPI
Kmac128
kmac128
standard FIPS key 1–268435456 · tag 16–1024 NIST SP 800-185 safe
Kmac256
kmac256
standard FIPS key 1–268435456 · tag 16–1024 NIST SP 800-185 safe
Kmacxof128
kmacxof128
standard FIPS key 1–268435456 · tag 16–1024 NIST SP 800-185 safe
Kmacxof256
kmacxof256
standard FIPS key 1–268435456 · tag 16–1024 NIST SP 800-185 safe

Frequently asked questions

Which KMAC variants does NextSSL include?

NextSSL registers 4 KMAC variants: kmac128, kmac256, kmacxof128, kmacxof256.