HMAC Generator

HMAC is a keyed hash. Anyone who can compute the same hex digest over the same body must hold the same secret. Webhooks, signed cookies, and API request canonicalisation use that property. A bare SHA-256 of the body is not the same thing: an attacker can recompute it without a key.

What the HMAC generator is for

An HMAC proves both that a message is unaltered and that it came from someone holding the shared secret. A plain hash cannot do the second part — anyone can recompute it — which is why signed webhooks and API requests use HMAC instead.

It is the mechanism behind Stripe and GitHub webhook signatures, AWS request signing, and most API authentication schemes that avoid sending a password with every call.

Common uses

  • Reproducing a webhook signature to debug why verification is failing
  • Signing API requests during development
  • Generating expected values for authentication tests
  • Confirming your implementation matches a provider's documented example

What the output means in the real world

The digest is the signature you attach as a header (often X-Hub-Signature-256 or a hex/Base64 field). The receiver HMAC's the raw body with the shared secret and compares in constant time. Never put the secret in the payload. If a signature leaks with the body, rotate the secret; the digest itself is not a password.

How this fits into real work

GitHub, Stripe, and Slack webhook docs all show HMAC-SHA-256 over the exact bytes on the wire. JSON re-serialisation changes whitespace and breaks the check. Sign what you send; verify what you received, not a pretty-printed clone.

RFC 2104 defines HMAC. SHA-256 and SHA-512 are the usual inner hashes. MD5-HMAC still appears in legacy ERP connectors; replace those when you can.

A leaked webhook secret lets an attacker forge events (paid invoices, deploys). Store it in a secret manager, not in the repo, and rotate it after any staff offboarding that had dashboard access.

How to use this tool

  1. Paste the exact message into the message field — for a webhook this is the raw request body, byte for byte.
  2. Enter the shared secret exactly as configured, with no surrounding whitespace.
  3. Choose the hash algorithm the other system specifies, usually SHA-256.
  4. Compare the result with the signature you received. They must match exactly.

Tips

  • Signature mismatches are almost always caused by the body being re-serialised. Sign the raw bytes as received, before any JSON parsing.
  • Compare signatures with a constant-time function in production code; a plain equality check can leak information through timing.
  • Check whether the provider expects hex or base64 — the same HMAC in the wrong encoding will never match.

Privacy & how it works

Everything happens inside your browser. The values you type are held in page memory only, are never sent to a server, and disappear when you close the tab. You can confirm this in your browser's network tab: the only request a tool makes is one that names the tool for a usage count, with nothing you typed in it. The tools also work with the internet disconnected. Computed with the browser's SubtleCrypto HMAC implementation. Do not paste production secrets into any browser tool.

Frequently asked questions

What is the difference between a hash and an HMAC?
A hash proves only integrity, and anyone can compute one. An HMAC mixes in a secret key, so it also proves the sender knew that key — that is authenticity.
Why does my webhook signature never match?
In nearly every case the body was modified before signing. Frameworks that parse and re-serialise JSON change whitespace and key order. Capture and sign the raw body.
Is HMAC-SHA1 still safe?
HMAC-SHA1 has not been broken in the way plain SHA-1 has, and remains in use for TOTP. Even so, choose HMAC-SHA256 for anything new.

Browse other tools

All tools run entirely in your browser — nothing you type is sent to a server, except the optional HIBP 5-character hash prefix.