HMAC Signature Generator & Verifier
RFC 2104 / FIPS 198-1Calculate and verify RFC 2104 Keyed-Hash Message Authentication Codes across HMAC-SHA256, HMAC-SHA512, HMAC-SHA1, and HMAC-MD5 with timing-safe verification.
Shared Secret Key
Message / Raw Payload
Multi-Format Encodings
Instant One-Click CopyReady-to-Use Webhook Headers
X-Hub-Signature-256)Stripe-Signature)X-Shopify-Hmac-Sha256)X-Slack-Signature)Webhook Signature Authenticity Verifier
Paste the signature header received from your webhook provider (e.g., Stripe, GitHub, Shopify). This tool strips prefixes, computes the expected hash in memory, and performs a timing-safe constant-time comparison to verify payload authenticity.
Supported Webhook Provider Presets
Select a provider specification below to instantly load its standard signature algorithm, headers, and test payloads.
Stripe Webhook Signature
Stripe signs webhooks using HMAC-SHA256 over concatenated string: `${timestamp}.${raw_payload}`. Verified against the `v1` signature tag.
GitHub Webhook Event
GitHub computes HMAC-SHA256 of the raw JSON request body using your webhook secret, formatted as `sha256=<hex_digest>`.
Shopify Webhook Notification
Shopify calculates HMAC-SHA256 of the raw HTTP request body and encodes it as Base64 in `X-Shopify-Hmac-Sha256`.
Slack Request Signing
Slack signs incoming requests with HMAC-SHA256 using the format `v0:${timestamp}:${body}` and sends header `v0=<hex_digest>`.
Twilio Request Validation
Twilio computes HMAC-SHA1 of full URL concatenated with sorted POST parameters and sends a Base64-encoded signature.
AWS Signature Version 4
Amazon Web Services uses multi-step HMAC-SHA256 derivation to sign REST API requests across S3, DynamoDB, and Lambda.
RFC 4231 Test Case 2 (SHA-256)
Official IETF HMAC-SHA256 conformance test vector. Expected: 5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843
RFC 4231 Test Case 2 (SHA-512)
Official IETF HMAC-SHA512 test vector with 64-byte digest. Expected: 164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea250554972247b83294b5cf4e421444030b3027f2a76e6d0180bd6f3e18f681c3f399f
Production Webhook Verification Code
Copy and paste production-ready verification logic with timing-safe comparison into your backend.
// Node.js (TypeScript / JavaScript)
import crypto from "crypto";
export function verifyWebhookSignature(payload: string, signatureHeader: string, secret: string): boolean {
// 1. Calculate HMAC-SHA-256
const hmac = crypto.createHmac("sha256", secret);
hmac.update(payload);
const calculatedSignature = hmac.digest("hex");
// 2. Extract expected signature (e.g., stripping "sha256=" or "v1=")
const expectedSignature = signatureHeader.replace(/^(sha256=|v1=|v0=)/, "").trim();
// 3. Timing-safe comparison to prevent timing side-channel attacks
if (calculatedSignature.length !== expectedSignature.length) return false;
return crypto.timingSafeEqual(
Buffer.from(calculatedSignature, "utf8"),
Buffer.from(expectedSignature, "utf8")
);
}
// Example usage:
const secret = "whsec_9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a1b0c";
const rawBody = '{
\"id\": \"evt_1P8kABCxyz123\",
\"object\": \"event\",
\"api_version\": \"2023-10-16\",
\"created\": 1773';
const sig = crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
console.log("Calculated HMAC:", sig);How HMAC Authentication Works
HMAC uses a two-pass hash calculation defined in RFC 2104: H((K ⊕ opad) || H((K ⊕ ipad) || M)). Inner and outer padding masks prevent length-extension attacks that cripple standard hash concatenation.
Preventing Replay Attacks
Top providers like Stripe and Slack prepend a Unix timestamp (e.g. t.payload) into the signed string. Always reject webhooks older than 5 minutes to render network-sniffed replays useless.
Timing-Safe String Comparison
Standard comparisons (==) return false on the first mismatch. Use crypto.timingSafeEqual() or hmac.compare_digest() to avoid sub-microsecond timing leak side-channel attacks.
Webhook Signature Specifications Comparison
| Service | Algorithm | HTTP Header Name | Output Encoding | Payload Format |
|---|---|---|---|---|
| GitHub | HMAC-SHA256 | X-Hub-Signature-256 | Hex (sha256=...) | Raw request body |
| Stripe | HMAC-SHA256 | Stripe-Signature | Hex (t=...,v1=...) | Timestamp + '.' + Raw body |
| Shopify | HMAC-SHA256 | X-Shopify-Hmac-Sha256 | Base64 | Raw request body |
| Slack | HMAC-SHA256 | X-Slack-Signature | Hex (v0=...) | v0 + ':' + Timestamp + ':' + Body |
| Twilio | HMAC-SHA1 | X-Twilio-Signature | Base64 | Full URL + Sorted POST params |
| AWS SigV4 | HMAC-SHA256 | Authorization | Hex lower | Derived signing key + string-to-sign |
Zero-Knowledge Local Execution
All data processing, parsing, and compilation execute strictly inside your local browser memory. Zero external server uploads.
Instant Local Cryptography
Instant real-time reactive computation delivers immediate feedback on every keystroke with zero network latency.
Production Standards & Compliance
Follows modern browser Web Crypto and security practices for safe client-side inspection.
HMAC Signature Generator & Verifier — Reference Guide
Calculate and verify RFC 2104 Keyed-Hash Message Authentication Codes across HMAC-SHA256, HMAC-SHA512, HMAC-SHA1, and HMAC-MD5 with timing-safe verification.
Major Webhook HMAC Signature Schemes Reference Table
Standard Hash-based Message Authentication Code (HMAC) signature verification schemes across leading cloud and payment webhook providers.
| Service / Platform | HMAC Algorithm | HTTP Signature Header | Signed Payload Format | Secret Key Format |
|---|---|---|---|---|
| Stripe Webhooks | HMAC-SHA256 | Stripe-Signature | timestamp + '.' + raw_body | whsec_... |
| GitHub Webhooks | HMAC-SHA256 | X-Hub-Signature-256 | Raw request body bytes | sha256=... |
| Shopify Webhooks | HMAC-SHA256 | X-Shopify-Hmac-Sha256 | Raw request body bytes | Base64 digest |
| Slack Events API | HMAC-SHA256 | X-Slack-Signature | 'v0:' + timestamp + ':' + body | v0=... |
| AWS Signature v4 | HMAC-SHA256 | Authorization | Canonical HTTP request + date | AWS4-HMAC-SHA256 |
Key Parameters & Controls
| Parameter | Type / Unit | Description | Default |
|---|---|---|---|
| Hash Algorithm | Enum (SHA-256 | SHA-512 | SHA-384 | SHA-1 | MD5) | Underlying cryptographic hash function for keyed hashing. SHA-256 is the universal standard for modern webhooks. | SHA-256 |
| Key Encoding | Enum (UTF-8 | Hex | Base64) | Encoding format of the shared secret key. Raw strings use UTF-8, while binary keys use Hex or Base64. | UTF-8 |
| Message Encoding | Enum (UTF-8 | Hex | Base64) | Encoding format of the raw payload string to be cryptographically signed. | UTF-8 |
| Output Format | Enum (Hex Lower | Hex Upper | Base64 | Base64URL) | Signature representation format. GitHub and Stripe use Hex lower; Shopify and AWS use Base64. | Hex Lower |
Pro Tips & Best Practices
Standard string equality (===) is susceptible to timing side-channel attacks. Our verifier implements constant-time O(1) byte comparisons.
GitHub sends sha256=<hex> in X-Hub-Signature-256. Stripe concatenates t=<timestamp>.<payload> and signs with HMAC-SHA256.
RFC 2104 recommends secret keys equal to or larger than the hash block size (e.g. 32 bytes for SHA-256).
Common Gotchas & Troubleshooting
⚠️Signature verification fails for valid webhook payload
Ensure exact byte parity including raw whitespace, newlines, and verify whether the key is expected as raw UTF-8 or Hex.
⚠️Base64 vs Base64URL format discrepancy
REST APIs and JWTs replace '+' with '-' and '/' with '_' without '=' padding. Switch output format to Base64URL if needed.
Frequently Asked Questions
What is HMAC and why is it safer than simple hashing?▼
HMAC (Keyed-Hash Message Authentication Code) uses a double-nested hashing construction with inner and outer padding (ipad and opad). This mathematical design prevents length extension attacks that plague naive hash(key + message) constructions.
How do webhook signatures work in Stripe, GitHub, and Shopify?▼
Webhook providers sign outbound HTTP payloads using a shared secret key via HMAC-SHA256. Receivers compute the expected HMAC of the incoming raw request body and compare it with the signature in headers (e.g. Stripe-Signature or X-Hub-Signature-256) using timing-safe comparisons.
Why is timing-safe comparison critical for HMAC verification?▼
Standard string comparison operators (like === in JavaScript or == in Python) return early on the first mismatched character. Attackers can measure response latency in microseconds to infer correct signature bytes one by one. Constant-time comparison checks all bytes regardless of mismatches, eliminating timing leaks.
Can I test AWS SigV4 signatures with this tool?▼
Yes. You can enter intermediate signing keys (kDate, kRegion, kService) as Hex bytes and sign canonical request strings to debug and verify each step of the AWS Signature Version 4 calculation.
Related Tools & Utilities
All Tools →Audit JWT tokens locally for known weak HMAC secret keys, brute-force dictionary vulnerabilities, and verify signatures against custom candidate secrets.
Generate, customize, and cryptographically sign custom JSON Web Tokens (JWT) using HMAC-SHA256, expiration dates, and custom claims client-side.
Decode, verify, and inspect JWT headers, payloads, and claims with local secret or public key without sending data to servers.
Compute instant cryptographic hashes entirely in browser with zero server transmission.
Inspect OpenSSH public keys (RSA, Ed25519, ECDSA), compute SHA-256 and MD5 fingerprints, and generate authentic OpenSSH ASCII Randomart visual art.
Inspect, parse, and validate RSA, ECDSA, and Ed25519 PEM keys (PKCS#1, PKCS#8, SPKI) locally in your browser with zero data transmission.