KMAC256 Message Authentication Code Generator

Compute a KMAC256 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.

KMAC256

Runs entirely in your browser. Your data is never uploaded.

What is KMAC256 Generator?

KMAC256 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 KMAC256 of text or raw bytes.

How to use KMAC256 Generator

  1. Type the data into Message; choose Hex bytes or Base64 as input encoding for binary data.
  2. Enter the Secret key and select its Key encoding (Text (UTF-8) or Hex bytes).
  3. Optionally enter a Customization string (S) and change Output length (bits) (default 512).
  4. Pick the Output format and click Copy to use the tag.

Example

Input
Message 00010203 (Hex bytes), key 404142…5E5F (32 bytes, hex), S = "My Tagged Application", 512 bits
Output
20c570c31346f703c9ac36c61c03cb64c3970d0cfc787e9b79599d273a68d2f7f69d4cc3de9d104a351689f27cf6f5951f0103f33f4f24871024d9c27773a8dd

NIST SP 800-185 KMAC sample #4.

When to use KMAC256 Generator

Use KMAC256 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 KMAC256 Generator works

KMAC256 (NIST SP 800-185) is cSHAKE256 with function name "KMAC". It absorbs bytepad(encode_string(K), 136) — 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

KMAC256 provides up to 256-bit security when the key is random and at least 32 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 KMAC256 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.

Explore more categories