How to use HMAC Generator
- Pick the algorithm the other system uses — SHA-256 unless its documentation says otherwise.
- Enter the shared secret key exactly, with no added whitespace.
- Paste the exact message being signed — the raw body, not a reformatted copy.
- Choose hex or Base64 to match the format you are comparing against, then copy the result.
- Computed with the Web Crypto API, the browser’s own cryptographic implementation.
- Hex output is lowercase; some providers publish uppercase, so compare case-insensitively.
- The key and message stay in your browser — but treat any secret pasted into any web page as worth rotating afterwards if it is a production key.
What HMAC adds that a plain hash does not
A hash proves a message has not changed. It does not prove who sent it, because anyone can hash anything. HMAC mixes a secret key into the hash in a specific two-pass construction, so only someone holding the key can produce a valid digest for a message — and anyone holding the key can verify one. That is why every webhook provider signs its payloads this way: the signature in the header proves the request came from them and arrived intact.
Why the construction matters, not just the ingredients
The obvious approach — hashing the key followed by the message — is broken for the SHA-1 and SHA-2 families, because their internal structure lets an attacker append data to a message and compute a valid digest for the longer version without knowing the key. That is the length-extension attack. HMAC’s two nested hashes with padded key variants close it. The practical lesson is to use HMAC rather than inventing a scheme, even a plausible one.
Debugging a signature mismatch
When a webhook signature will not verify, it is almost never the algorithm. In order of likelihood: you are hashing the parsed and re-serialised body instead of the exact raw bytes received; the output encoding differs (hex against Base64, or uppercase against lowercase hex); the key has trailing whitespace from a copy-paste or a .env file; or the provider signs a constructed string — timestamp plus a dot plus body — rather than the body alone. Reproduce it here with a known payload before you change any code.
Choosing the algorithm, and comparing safely
SHA-256 is the default nearly everywhere and the right choice for new work. HMAC-SHA1 is still in wide use and, unusually, is not considered broken — HMAC’s security does not rest on the collision resistance that SHA-1 lost — but there is no reason to choose it now. Whichever you use, compare signatures with a constant-time comparison in production code: a normal string comparison returns early on the first differing byte, which leaks enough timing information to forge a signature byte by byte.
Frequently asked questions
What is an HMAC?
How is HMAC different from a plain hash?
Which algorithm should I choose?
What is the difference between HMAC and a plain hash?
Is HMAC-SHA1 still safe?
My webhook signature will not verify. What should I check first?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.