Skip to main content
CalcChef

HMAC Generator

Compute an HMAC with SHA-1, SHA-256, SHA-384 or SHA-512 and check it against a signature, with webhook presets for GitHub, Stripe, Shopify and Slack. How it works

Use the HMAC Generator

Pick a webhook provider to set the key format, algorithm, output format and signed text; every setting stays editable.

Read as UTF-8 text; may be empty. Up to 1,000,000 characters.

May be empty. Up to 100,000 characters.

Result
f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8

Paste a signature as hex, Base64 or Base64URL to compare it with the result.

HMAC-SHA-1 is not weakened by SHA-1 collisions, but new designs should use SHA-256 or stronger.

About the HMAC Generator

HMAC-SHA256 of the message “The quick brown fox jumps over the lazy dog” with the key “key” is f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8. This HMAC generator computes HMAC with SHA-1, SHA-256, SHA-384 or SHA-512 as RFC 2104 defines it, prints hex, Base64 or Base64URL, and compares the result with a signature you paste. Presets for GitHub, Stripe, Shopify, Slack and Standard Webhooks build the exact text each provider signs.

The same key and message with each hash

AlgorithmBlock sizeHMAC lengthHMAC in hex
SHA-164 bytes20 bytesde7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9
SHA-25664 bytes32 bytesf7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8
SHA-384128 bytes48 bytesd7f4727e2c0b39ae0f1e40cc96f60242d5b7801841cea6fc592c5d3e1ae50700582a96cf35e1e554995fe4e03381c237
SHA-512128 bytes64 bytesb42af09057bac1e2d41708e48a902e09b5ff7f12ab428a4fe86653c73dd248fb82f948a549f7b791a5b41915ee4d1ec3935357e4e2317250d0372afa2ebeeb3a

Key “key” and message “The quick brown fox jumps over the lazy dog”, both as UTF-8 text.

HMAC-SHA256 of the same input in each output format

Output formatValue
Hexf7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8
Base6497yD9DBThCSxMpjmqm+xQ+9NWaFJRhdZl0edvC0aPNg=
Base64URL97yD9DBThCSxMpjmqm-xQ-9NWaFJRhdZl0edvC0aPNg

Webhook provider presets

ProviderSigned textKeySignatureHeader
GitHubrequest bodywebhook secret as texthex with sha256= prefixX-Hub-Signature-256
Stripetimestamp + "." + bodywhsec_ signing secret as texthexStripe-Signature (the v1= value)
Shopifyrequest bodyapp client secret as textBase64X-Shopify-Hmac-SHA256
Slack"v0:" + timestamp + ":" + bodysigning secret as texthex with v0= prefixX-Slack-Signature
Standard Webhooksid + "." + timestamp + "." + bodyBase64 part of the whsec_ secretBase64 with v1, prefixwebhook-signature

All five use HMAC-SHA256, from each provider’s verification page. The timestamp is in Unix seconds, copied from the request header. Stripe and Slack advise rejecting a request whose timestamp is more than 5 minutes old; this page does not check the age.

How to use this tool

  1. To check a GitHub webhook, choose GitHub under Provider preset, put the webhook secret in Secret Key and paste the request body exactly as it arrived into Message.
  2. Paste the X-Hub-Signature-256 header value into Expected signature; with the preset, the sha256= prefix may stay.
  3. Read Match or No match. No match with the right secret usually means the body was changed on the way, for example re-formatted JSON.

Frequently asked questions

How do I verify an HMAC signature, for example from a webhook?
Compute the HMAC of the exact body you received with the shared secret and the provider’s hash, then paste the signature they sent into Expected signature. It is read as hex, Base64 or Base64URL and the tool says Match or No match. With a provider preset, a prefix such as sha256= may stay on the pasted value; without one, remove it first or the signature is not read.
Can the HMAC key be empty?
Yes. RFC 2104 pads the key with zero bytes to the block size, so an empty key is valid. HMAC-SHA256 with an empty key and an empty message is b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad.
What happens to a key longer than the block size?
It is hashed first and the hash is used as the key, as RFC 2104 says. The tool uses a 64-byte block for SHA-1 and SHA-256 and a 128-byte block for SHA-384 and SHA-512.
How long should an HMAC key be?
RFC 2104 recommends at least the length of the hash output, 32 bytes for SHA-256, and strongly discourages shorter keys. A key much longer than that adds little strength.
Is HMAC encryption?
No. An HMAC shows that whoever made it had the same secret key and that the message was not changed; the message itself stays readable.
Is my secret key uploaded?
The HMAC is computed by code in this page with the browser’s Web Crypto hash; the key and message are not uploaded or saved by the tool. Web Crypto works only on https pages and on localhost.

Related Tools

View all tools