KMAC128 File MAC Calculator
Compute the KMAC128 authentication tag of a file with your secret key and customization string, locally in your browser, and compare with an expected tag.
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.
No file selected yet. The checksum appears as soon as you pick a file.
The file is read in chunks inside your browser and is never uploaded.
What is KMAC128 File MAC?
This tool computes the KMAC128 tag of a file using a secret key, an optional customization string and the output length you choose, and compares it with an expected tag. Unlike a plain checksum, a matching tag shows the file was produced by someone who knows the key.
How to use KMAC128 File MAC
- Enter the Secret key and Key encoding, plus an optional Customization string (S) and Output length (bits); changing them recomputes the tag.
- Click the drop zone or drag a file onto it; the file is read in chunks and a progress bar is shown.
- Check the File name and File size shown below to make sure you picked the right file.
- Paste the checksum published by the provider into Expected checksum — you get Match or Mismatch (case,
0xand a trailing file name are ignored). - Choose the Output format and click Copy to store or send the tag.
Example
A file hash-abc.txt containing "abc", key "secret" (UTF-8), S empty
9723991ae89d1a16b62b38aaa31cb025d0612906eb4f2885a73efc7d43091523
Output length 256 bits.
When to use KMAC128 File MAC
Use it to check that a file comes from a party sharing your secret key, or to create tags for files in a KMAC-based system. To verify a public download, a checksum or digital signature is the right tool — a MAC requires both sides to share the key.
How KMAC128 File MAC works
The padded key is absorbed first, then the file in 4 MB slices, then the encoded output length, before the tag is squeezed. 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 the authenticity tag of a firmware or backup file
- Create keyed fingerprints of files that outsiders cannot reproduce
- Test a KMAC implementation on large inputs
Security Note
Use a random secret key of at least 16 bytes. The tag offers no protection if the key leaks. All processing is local.
FAQs
Are the file and key uploaded?
No. Both stay in your browser; the file is read locally in chunks.
Why does my tag not match?
Key bytes (check the key encoding), customization string and output length must all match exactly, as well as the file content.
Is a KMAC tag a signature?
No. Anyone with the shared key can create a valid tag, so it proves possession of the key, not the identity of one specific signer.