HMAC-SHA256 is a keyed-hash message authentication code: it mixes a secret key with a message and the SHA-256 hash function to produce a 256-bit tag. Unlike a plain hash, the tag cannot be forged or recomputed without the key, which is why APIs and webhook providers use it to sign requests. This tool computes it locally using the browser’s Web Crypto API.
How it works
HMAC is defined (RFC 2104) as:
HMAC(K, m) = H( (K' XOR opad) || H( (K' XOR ipad) || m ) )
where H is SHA-256, K' is the key padded or hashed to the block size, ipad/opad are fixed padding constants, and || is concatenation. The double-hashing structure is what makes HMAC resistant to length-extension attacks that affect naive H(key || message) constructions.
This tool imports your key as raw bytes (interpreting it as UTF-8 text or hex), signs the message with crypto.subtle.sign, and renders the resulting 32-byte MAC as both lowercase hex (64 characters) and Base64.
Tips
- To verify a provider’s webhook signature, paste the exact raw request body as the message and your signing secret as the key, then compare the hex output to the signature header.
- The same key and message always produce the same tag; any change to either, even one byte, completely changes the output.
- Computation is local — your secret never leaves the browser.