What is an HMAC?
An HMAC (Hash-based Message Authentication Code, RFC 2104) combines a cryptographic hash with a secret key. Anyone can recompute a plain SHA-256 hash, but only someone who holds the key can produce the right HMAC. That makes it the standard way to sign API requests and webhook payloads.
Where You Will Meet HMAC Signatures
- GitHub webhooks:
X-Hub-Signature-256: sha256=<hex>over the raw body. - Stripe webhooks:
v1=<hex>overtimestamp.body. - Shopify webhooks:
X-Shopify-Hmac-Sha256, Base64 of HMAC-SHA256 over the raw body. - Slack requests:
v0=<hex>overv0:timestamp:body. - JWTs signed with HS256: the signature is a Base64URL HMAC-SHA256 of
header.payload.
The Most Common Mistake
Signatures are computed over bytes. If your server parses the JSON body and serialises it again, the whitespace or key order can change and the HMAC will no longer match. Always verify against the raw request body, and compare signatures with a constant-time function (for example crypto.timingSafeEqual in Node.js) in production code.
Related Tools
For unkeyed checksums use the Hash Generator. To inspect or create HS256 tokens, see the JWT Decoder and JWT Generator.

