HMAC Hash Generator
Create a keyed message-authentication code locally in your browser.
HMAC Generator
Sign a message with a shared secret and a secure hash function.
- Enter message
- Add secret
- Generate HMAC
HMAC: authenticate a message with a shared secret
Understand HMAC, how it differs from a normal hash, and how to use it safely in compatibility tests.
HMAC is a keyed-hash construction used to check message authenticity and integrity. It combines a secret key with a hash function such as SHA-256, SHA-384, or SHA-512. A recipient who has the same secret can calculate the HMAC independently; if the values match, the message is likely unchanged and was created by someone who knew the secret. Unlike a normal SHA-256 digest, an HMAC is not useful to an observer who does not know the key.
To reproduce an HMAC from another system, copy the message bytes, selected hash algorithm, secret key bytes, and output representation exactly. Tiny differences matter: JSON spacing, line endings, URL encoding, timestamps, and the difference between a text key and a hexadecimal key can all change the result. This browser utility helps test a documented signing scheme, but it should not be used as the whole authentication architecture for a public application.
Protect the HMAC key like any other credential. Use a unique, random secret with sufficient length, do not embed it in frontend code, and rotate it when exposure is suspected. Compare received HMAC values using a timing-safe comparison in a production service. An HMAC shows that a key holder created a message, but it does not encrypt the content; use TLS and encryption separately when confidentiality is required. For APIs, also include an expiration or nonce in the signed input to limit replay attacks.
A careful workflow
- Select the hash algorithm specified by the protocol.
- Enter the exact message and secret key byte representation used by the sender.
- Compare a complete HMAC value with timing-safe code in a production application.
FAQ
Is HMAC encryption?
No. HMAC authenticates a message; it does not hide its contents.
Can I use a normal SHA-256 hash instead?
Not for authentication. A normal hash has no secret and can be recomputed by anyone.
Why does an HMAC not match another service?
Check the message bytes, newline handling, key encoding, selected algorithm, and output format.
Further reading: NIST guidance on keyed-hash message authentication