HMAC Generator
Generate secure Keyed-Hash Message Authentication Codes (HMAC) using the SHA-256 algorithm. Essential for API authentication and data integrity.
// Hash will appear here...
Security Note
This tool runs locally in your browser using the Web Crypto API. Your secret keys never leave your device.
About the HMAC Generator
Enter a secret key and a message to get the HMAC-SHA256 signature – the value APIs and webhooks use to prove a request is genuine and unaltered.
Everything you enter is processed in your browser; nothing is uploaded or stored.
How to use it
- Enter the shared secret key.
- Enter the exact message (for example the raw webhook body).
- Copy the HMAC SHA-256 signature and compare it with the one you received.
How HMAC signatures work
HMAC mixes the secret key into a SHA-256 hash of the message in two passes. Anyone with the key can recompute the signature; anyone without it cannot forge one, and changing a single byte of the message changes the signature completely.
Payment gateways and webhook senders sign each request this way. Your server recomputes the HMAC over the raw body with the shared secret and rejects the request if it does not match.
Tips
- Sign the exact raw body bytes; re-serialising JSON changes spacing and breaks the match.
- Compare signatures with a constant-time comparison on your server.
Frequently asked questions
Is HMAC the same as SHA-256?
No. SHA-256 is a plain hash anyone can compute; HMAC-SHA256 also needs the secret key.
Is my secret key sent anywhere?
No. The signature is computed in your browser with the Web Crypto API. Still, avoid pasting production secrets on shared computers.
Why does my HMAC not match the provider’s?
Usually a different message (extra whitespace, decoded vs raw body), a different encoding (hex vs Base64) or the wrong key.