HMAC generator — SHA-256, SHA-384 and SHA-512
A HMAC (Hash-based Message Authentication Code, RFC 2104) combines a secret key with your message to produce a keyed hash. Anyone who knows the key can recompute the same value, which proves the message was not tampered with and came from someone holding the key. It is the standard way to sign API requests and verify webhook payloads.
How it works
The tool uses the browser’s Web Crypto API. It UTF-8 encodes your secret key
and imports it as an HMAC key bound to the chosen hash (SHA-256, SHA-384 or
SHA-512), UTF-8 encodes your message, then calls crypto.subtle.sign to produce
the authentication code. The resulting bytes are rendered as a lowercase hex
string. Internally HMAC hashes the key combined with the message twice with inner
and outer padding, which is what makes it resistant to length-extension attacks
that affect a naive key-plus-message hash. The output updates live as you type.
Example
With key topsecret and message hello, HMAC-SHA-256 produces a fixed 64-character
hex string. Re-running with the same inputs always gives the same value; changing
a single character of either input changes the entire output.
| Algorithm | Output bits | Hex length |
|---|---|---|
| HMAC-SHA-256 | 256 | 64 |
| HMAC-SHA-384 | 384 | 96 |
| HMAC-SHA-512 | 512 | 128 |
Everything runs locally in your browser via the Web Crypto API — your key and payload are never sent over the network.