Before a webhook integration goes live, someone has to prove the signatures work. The proof usually fails for a silly reason: the payload that was signed is not quite the payload that was sent. A space moved, a newline crept in, or a JSON object was re-typed by hand. Two correct tools then produce two different signatures, while both sides insist they did everything right.

This guide removes the guesswork with one complete worked signing, using the free HMAC Generator on Ovatly. The tool signs a message with a shared secret key via Web Crypto. It shows the signature in hex and Base64. You will check the setup against a published test value. You will sign a small JSON payload as an exact byte string. Then you will change one character and watch what happens.

Contents

  • Quick answer
  • Step zero: the known-answer check
  • The test payload and the test secret
  • How to sign the payload, step by step
  • Worked example: one character changes, everything changes
  • Reading the signature in the encoding the receiver expects
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

First sign the published test value (key key, message The quick brown fox jumps over the lazy dog, SHA-256) in the HMAC Generator. Confirm you get the known signature. Then paste your test payload exactly as the byte string you will send. Enter a test secret, and pick SHA-256, SHA-384 or SHA-512 as the receiver specifies. Compute the signature, and copy it in the encoding the receiver expects. Sign the raw bytes you send, never a re-typed version of them.

Step zero: the known-answer check

Every signing session should start with a value whose answer is already published, because it separates tool problems from payload problems. The test value for this generator is:

  • Key: key
  • Message: The quick brown fox jumps over the lazy dog
  • Hash: SHA-256
  • Expected signature:
f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8

If your run reproduces that value, the signing path is correct, full stop. From then on, any mismatch you meet is information about the payload bytes or the key. That is exactly the information a test is supposed to give you. Skipping this step leaves you debugging two unknowns at once.

The test payload and the test secret

A webhook payload is usually JSON, so the worked example uses a small one:

{"event":"ping","id":1}

Treat that line as a byte string, not as data to be understood. The signature does not care what the JSON means; it covers the characters exactly as they stand, in that order, with that spacing. The test secret for this example is test-secret, a throwaway key used only because the payload is a test. A real integration gets its own random key of 32 bytes or more, which is a sound default for HMAC-SHA-256. That key is never published anywhere.

How to sign the payload, step by step

  1. Open the HMAC Generator and run the known-answer check above with SHA-256 selected.
  2. Replace the message with the test payload, pasted as the exact byte string you will send. Do not tidy the spacing and do not add a newline at the end.
  3. Replace the key with the test secret.
  4. Compute the HMAC and read the signature in both encodings. For this payload and key, SHA-256 gives:
hex:    7bf60fb167f6974e6288b5ba38bfeb14cefa65db0ccc5b124e94a4b58fb52914
Base64: e/YPsWf2l05iiLW6OL/rFM76ZdsMzFsSTpSktY+1KRQ=
  1. Send the signature in the encoding the receiver expects. Keep the payload file you signed from, so the test can be repeated byte for byte.

Worked example: one character changes, everything changes

Now change exactly one character of the payload: the 1 becomes a 2.

{"event":"ping","id":2}

Sign it again with the same key and the same hash. The signature is:

7bf60fb167f6974e6288b5ba38bfeb14cefa65db0ccc5b124e94a4b58fb52914
d87dca002ecf4f22291d1642eb4dc8133ffbe2dff1399f3dc572732080d78220

The first line is the original signature, the second is the new one. One digit changed in the message and nothing survives in the signature: the two values share no pattern a reader could follow. That total change is the property a webhook signature exists for. It is also why the discipline matters. If a single deliberate character does this, a single accidental character does it too: a trailing newline from an editor, or spacing added while re-typing. And the receiver's verification fails on a payload you would swear was identical.

Reading the signature in the encoding the receiver expects

The generator shows every signature twice, in hex and in Base64, because receivers differ. The two forms are the same bytes in two encodings, so neither is more correct. The receiver's documentation names the one it compares against, and that name settles it. Sending hex to a receiver expecting Base64 produces a mismatch that looks exactly like a signing error. That is why the encoding belongs in your test notes next to the payload and the key.

Limitations and honest tradeoffs

The signing happens on your device, but you should still never sign production secrets on an untrusted machine. Test payloads get test secrets, as this guide does throughout. An HMAC also authenticates rather than encrypts. The payload stays readable to anyone who sees it. The signature proves only that it came from a holder of the shared key and was not altered. Anyone with the key can sign as well as verify, so HMAC suits shared-secret setups, not public-key signatures. And there is no way back from a signature: you cannot decrypt an HMAC, verification is always signing again and comparing.

Common mistakes

  • Re-typing the payload into the signing tool. Typing invites changed spacing and a stray newline. Paste the exact bytes from the file or request body you will actually send.
  • Pretty-printing the JSON before signing. Reformatting changes the bytes. If the receiver verifies against the raw body, sign the raw body, in its original shape.
  • Skipping the known-answer check. Without it, a wiring error and a payload error look identical. You can spend an hour debugging the wrong one.
  • Testing with the production secret. A test that leaks its key teaches the wrong habit. Test secrets for test payloads, and a separate random key for the real integration.
  • Comparing signatures across encodings. Hex against Base64 never matches, even for a correct signature. Convert first, or copy the form the receiver named.

FAQs

What is the known-answer check before signing a payload? Sign the published test value: key key, message The quick brown fox jumps over the lazy dog, HMAC-SHA-256. If your setup returns f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8, the signing path is correct and any later mismatch is about the payload or key, not the tool.

Why did my signature change when the payload looks identical? Because the bytes were not identical. Whitespace and line endings are part of the message, so a trailing newline, different spacing or a re-serialised key order all sign differently. Sign the exact byte string you send, and compare bytes rather than appearances when a signature disagrees.

Should I send the signature in hex or Base64? Whichever the receiver expects. Hex and Base64 are the same signature bytes in two encodings, and the generator shows both. A receiver comparing in the other encoding will report a mismatch against a perfectly correct signature, so match its documentation.

Can I use the test secret from this guide in production? No. A published test secret is public, and anyone holding the key can sign. Use a test secret only for test payloads. Give the real integration its own random key of 32 bytes or more, which is a sound default for HMAC-SHA-256.

How does the receiver verify my webhook signature? By signing again and comparing. The receiver takes the payload bytes exactly as received. It signs them with the shared secret and the same hash, and checks that the result equals the signature you sent. There is no decryption step, because an HMAC cannot be decrypted.

Conclusion

A webhook test you can trust has three parts. The first is a known-answer check that clears the tool. The second is a payload signed as the exact bytes you will send. The third is a one-character change that proves the signature reacts to everything. The HMAC Generator runs all three in your browser. If the remaining question is which of its hashes to standardise on, see which hash an HMAC should use. For more guides in this series, see our Security and Privacy guides.

References