HMAC Generator
HMAC (Hash-based Message Authentication Code) proves that a message came from someone who holds a shared secret and was not tampered with. This generator computes HMAC signatures with SHA-1, SHA-256, SHA-384, or SHA-512 using the browser Web Crypto API.
HMAC proves a message came from someone holding the key — pair it with SHA-256 for the digest itself. If you need confidentiality rather than authenticity, use AES.
How to use the HMAC Generator
- 1 Paste the message you want to authenticate into the message field.
- 2 Enter the shared secret key — this is the value both parties hold.
- 3 Choose the hash function; SHA-256 is the common default for new integrations.
- 4 Copy the hex or Base64 signature and send it alongside the message.
RFC 2104 Hash-Based Message Authentication Code calculation
The HMAC Generator computes keyed-hash message authentication codes according to RFC 2104. HMAC combines a secret cryptographic key with input message data using an underlying cryptographic hash function (such as SHA-256, SHA-512, or MD5) through two distinct hashing passes: HMAC(K, m) = H((K' ⊕ opad) || H((K' ⊕ ipad) || m)).
HMAC guarantees both data integrity and data authenticity: because the sender and recipient share a secret key, an attacker cannot forge a valid HMAC even if they intercept and modify the message payload. HMAC-SHA256 is the universal standard for signing REST API requests (such as AWS Signature Version 4 and GitHub webhooks).
- Calculates authenticated HMAC signatures across SHA-256, SHA-512, and MD5 algorithms.
- Complies strictly with RFC 2104 dual-pass cryptographic message authentication.
- Generates standard hex or Base64 signature strings for webhook payload verification.
- Universal standard for securing REST API endpoints, payment gateways, and webhooks.
Frequently asked questions
How is HMAC different from a plain hash?
A plain hash of a message can be recomputed by anyone, so it proves nothing about who sent it. HMAC mixes in a secret key, so only someone holding that key can produce a valid signature — that is what makes it an authentication code rather than a checksum.
Why not just hash the secret and the message together?
That construction is vulnerable to length-extension attacks, where an attacker appends data and computes a valid new hash without knowing the key. HMAC’s specific two-pass structure was designed to close exactly that hole.
Where is HMAC used in practice?
Webhook signing (Stripe, GitHub and others sign payloads this way), AWS request signing, and JWT signatures with HS256. In each case the receiver recomputes the HMAC and compares it to detect tampering.
Related Security & Cryptography Tools
You might also need
Tools from other categories that people pair with the HMAC Generator: