AES-CMAC Generator

Compute an AES-CMAC (block-cipher message authentication code, NIST SP 800-38B / RFC 4493) from a message and a secret AES key. The key length picks the variant — AES-128, AES-192 or AES-256 — and the tag comes back in hex or base64. Runs entirely in your browser, no server, no sign-up.

CMAC tag

About this tool

This AES-CMAC generator computes a block-cipher message authentication code from a message and a secret AES key, right in your browser. The computation runs locally in WebAssembly — your message and key are never uploaded to a server, which makes it safe for symmetric keys and other sensitive values.

CMAC (Cipher-based MAC, standardised in NIST SP 800-38B and RFC 4493) keys the AES block cipher, derives two subkeys, and runs a CBC-MAC-style chain over the padded message to produce a 16-byte tag. Like any MAC, the tag cannot be recomputed or forged without the key, so it proves both that a message is unaltered (integrity) and that it came from someone holding the key (authenticity). CMAC is used where a block cipher — rather than a hash — is the available primitive: IoT and smart-card protocols, IEEE 802.1X / RADIUS, and key-derivation schemes.

Which AES variant?

CMAC's underlying cipher is chosen by the key length:

A plain text key is used as its raw UTF-8 bytes, so it must be exactly 16, 24, or 32 characters long; for any other binary key, set Interpret key as to hex or base64. The output tag is always 16 bytes (128 bits) regardless of variant.

Options

Notes

FAQ

How do I choose between AES-128, AES-192, and AES-256 CMAC?

You don't pick it directly — the AES variant follows the key length: a 16-byte key gives AES-128-CMAC, 24 bytes gives AES-192, 32 bytes gives AES-256. Any other key length is rejected with an error. A plain-text key is measured in raw UTF-8 bytes; for a binary key, set Interpret key as to hex (32/48/64 hex chars) or base64.

Why is the tag always 32 hex characters, even with AES-256?

The CMAC tag is one AES block — 16 bytes (128 bits) — regardless of key size, so hex output is always 32 characters. Some protocols (e.g. AES-CMAC-96) truncate the tag; if your target expects a shorter value, compare against the leading bytes of the full tag.

Can I use this to verify a CMAC I received?

Yes — recompute the tag over the same message with the same key and the same encodings, then compare it to the tag you were given. There's no separate verify mode because verification is recomputation; in production code, do the comparison constant-time.

Is an empty message allowed?

Yes. CMAC of the empty message is well-defined (the padding subkey handles it), and it's actually the first RFC 4493 test vector: with key 2b7e151628aed2a6abf7158809cf4f3c the tag is bb1d6929e95937287fa37d129b756746. Pasting that key with an empty message is an easy way to sanity-check the tool.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool cmac-generate "The data to authenticate" 'key=16, 24, or 32 bytes (AES-128/192/256)'

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/cmac-generate/?message=The%20data%20to%20authenticate&key=16%2C%2024%2C%20or%2032%20bytes%20%28AES-128%2F192%2F256%29&message_encoding=text&key_encoding=text&output_format=hex&uppercase=true

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.