What it does
HMAC (Hash-based Message Authentication Code) combines a message with a secret key and a hash function to produce a short tag. Anyone who holds the same key can recompute the tag and confirm the message is authentic and unmodified; anyone without the key cannot forge a valid tag. It is the mechanism behind most webhook signatures (Stripe, GitHub, Slack and others). Pick the hash, type the key and the message, and you get the signature as a lowercase hex digest, computed with the browser's native Web Crypto API.
Choosing the hash
The digest length follows the hash: SHA-1 is 40 hex chars, SHA-256 64, SHA-384 96 and SHA-512 128. HMAC-SHA256 is the sensible default and what most webhook providers use. HMAC-SHA1 is still cryptographically sound for authentication (the collision attacks on plain SHA-1 don't break HMAC), but new designs should prefer SHA-256 or stronger.
Gotchas
- Encoding matters. This tool treats both key and message as UTF-8 text. If a provider's key is hex or base64, decode it to raw bytes first (e.g. with Base64) — signing the literal hex string gives a different, wrong result.
- Exact bytes matter. A trailing newline, different line endings (
\nvs\r\n), or a reordered JSON body all change the signature. Sign the raw request body exactly as sent, not a re-serialised copy. - Hex vs base64 output. Many APIs send the signature base64-encoded or prefixed (e.g.
sha256=…). This tool outputs hex; convert if you are comparing against such a header. - When verifying, compare with a constant-time check on the server to avoid timing leaks — a plain string
==can be attacked.
Worked example
To verify a GitHub webhook, GitHub signs the raw JSON payload with your webhook secret using HMAC-SHA256 and sends it as X-Hub-Signature-256: sha256=<hex>. Paste the secret as the key, the exact payload as the message, pick SHA-256, and the hex digest here should match the part after sha256=. HMAC differs from a plain hash precisely because of that secret key — without it, anyone could fake the tag.
Privacy
The key and message stay in your browser and are never uploaded.