KMAC128 Message Authentication Code Generator
Compute a KMAC128 message authentication code with your key (text or hex), customization string and output length. Matches NIST SP 800-185 samples.
A multiple of 8, from 8 to 16384 bits.
Optional domain-separation label, e.g. your application name. Different strings give unrelated outputs.
The key is empty. Without a secret key, KMAC does not authenticate anything.
Runs entirely in your browser. Your data is never uploaded.
What is KMAC128 Generator?
KMAC128 is the Keccak-based message authentication code from NIST SP 800-185, the SHA-3 counterpart of HMAC. Given a secret key, an optional customization string and an output length, it produces a tag that only holders of the key can compute. This tool computes KMAC128 of text or raw bytes.
How to use KMAC128 Generator
- Type the data into Message; choose Hex bytes or Base64 as input encoding for binary data.
- Enter the Secret key and select its Key encoding (Text (UTF-8) or Hex bytes).
- Optionally enter a Customization string (S) and change Output length (bits) (default 256).
- Pick the Output format and click Copy to use the tag.
Example
Message 00010203 (Hex bytes), key 404142…5E5F (32 bytes, hex), S = "My Tagged Application", 256 bits
3b1fba963cd8b0b59e8c1a6d71888b7143651af8ba0a7070c0979e2811324aa5
NIST SP 800-185 KMAC sample #2.
When to use KMAC128 Generator
Use KMAC128 to authenticate messages or derive keys in systems built on SHA-3, or to verify KMAC tags from a specification or another implementation. If the other side expects HMAC-SHA256, KMAC will not interoperate — use HMAC there. Do not use an empty or guessable key; a MAC is only as strong as its key.
How KMAC128 Generator works
KMAC128 (NIST SP 800-185) is cSHAKE128 with function name "KMAC". It absorbs bytepad(encode_string(K), 168) — the key padded to a full block — then the message, then right_encode(L) with the requested output length L, and squeezes L bits. Because L is part of the input, a 256-bit and a 512-bit KMAC of the same data are unrelated (unlike SHAKE). The sponge design makes the simple key-prefix construction secure, so KMAC does not need HMAC's nested structure.
Common Use Cases
- Verify NIST SP 800-185 KMAC test vectors
- Debug a KMAC implementation in another language
- Generate an authentication tag for an API or message in a SHA-3 based protocol
- Derive a key with KMAC as a KDF (SP 800-108 style) for testing
Security Note
KMAC128 provides up to 128-bit security when the key is random and at least 16 bytes long. Use a fresh, secret key and compare tags in constant time in your own code. Never paste production keys into tools you do not trust; this one runs locally and sends nothing.
FAQs
How is KMAC128 different from HMAC?
HMAC wraps a hash twice to avoid length-extension problems of SHA-2. Keccak is not vulnerable to length extension, so KMAC simply prefixes the padded key. Results are not interchangeable.
Why does changing the output length change all bits?
The output length L is encoded into the input, so KMAC with 256 and 512 bits are independent values — the shorter one is not a prefix of the longer one.
How should I enter a binary key?
Set Key encoding to Hex bytes and paste the key as hex (spaces allowed). With Text (UTF-8) the characters themselves are used as key bytes.
Is my key sent anywhere?
No. The key and message are processed in your browser only.