HMAC Generator & Verifier

Compute and verify RFC 2104 HMAC-SHA256, SHA-384, SHA-512, SHA-1, and MD5 signatures in Hex, Base64, or Base64URL locally in your browser via Web Crypto.

No uploadsNo sign-upInstant results
HMAC-SHA256 · SHA512 · MD5Hex · Base64 · Base64URL100% Local • Zero Uploads
Compute HMAC
Offline engine ready100% private in-browser workspace • Zero cloud uploads
100% Private • Zero Server File Uploads

Why Use Utiliome's Free HMAC Generator & Verifier?

Built from the ground up for strict privacy, instant execution, and zero friction. No subscriptions, paywalls, or account registrations required.

RFC 2104 & FIPS 198-1 Compliant Construction

Implements standard block-sized inner (0x36) and outer (0x5c) XOR key padding across HMAC-SHA256, HMAC-SHA384, HMAC-SHA512, HMAC-SHA1, and HMAC-MD5, verified against IETF RFC 2202 and RFC 4231 test vectors.

UTF-8, Hex, and Base64 Secret Key Decoding

Parses signing secrets as UTF-8 text, raw hexadecimal octets, or RFC 4648 Base64 byte buffers so binary API keys are decoded to exact key bytes prior to HMAC derivation.

Constant-Time Signature Verification Mode

Validates incoming webhook or API MAC headers against computed signatures using Web Crypto crypto.subtle.verify and fixed-length bitwise XOR comparison without leaking prefix timing.

Hex, Base64 & Base64URL Webhook Outputs

Produces digests in lowercase/uppercase Hex (GitHub, Stripe, Slack), standard padded Base64 (Shopify, AWS), and unpadded Base64URL (JWS/JWT segments) completely offline in local browser memory.

Utiliome vs Traditional Cloud Alternatives

Compare our local-first WebAssembly engine against legacy cloud tools.

Feature Utiliome (Local Browser) Legacy Cloud Converters
RFC 2104 Cryptographic Primitives Hardware-accelerated Web Crypto HMAC-SHA256, HMAC-SHA384, HMAC-SHA512 & SHA-1 Slow JavaScript polyfills or server-side endpoints that expose secret keys
Key & Output Encoding Flexibility Accepts UTF-8 text or raw Hex secret keys and outputs Hex, Base64, or Base64URL Treats hex secret keys as ASCII strings, producing wrong webhook signatures
Built-In Webhook Signature Verifier Constant-time signature comparison mode for debugging Stripe, GitHub & Slack Generation only — requires manual visual inspection of 64-char hex strings
Secret Key Confidentiality 100% local in-browser computation — API signing secrets never cross the network Transmits your production HMAC secret and payload over HTTP POST
How it works

How to Use HMAC Generator & Verifier in 3 Easy Steps

No software installation required. Everything runs directly inside your web browser.

1

Supply Exact Message Payload

Paste the raw unformatted HTTP request body or canonical signing string—preserving exact whitespace and key ordering—or drop a captured payload file.

2

Configure Secret Key Encoding & Hash

Enter your shared secret, select its byte representation (UTF-8 plain text, Hex, or Base64), and pick HMAC-SHA256, HMAC-SHA384, HMAC-SHA512, HMAC-SHA1, or HMAC-MD5.

3

Copy MAC or Verify Incoming Signature

Copy the resulting Hex, Base64, or Base64URL digest, or paste an expected signature (stripping transport prefixes like sha256= or v0=) to run constant-time verification.

Computing and Verifying Webhook & API HMAC Signatures: Practical Walkthrough

Quick Answer: Signing the message what do ya want for nothing? with the 4-byte secret Jefe (IETF RFC 4231 Test Case 2) under HMAC-SHA256 produces 5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843 in Hex and W9zBRr9gdU5qBCQmCJV1x1oAPwidJzmDnexYuWTsOEM= in Base64 across UTF-8, Hex (4a656665), and Base64 (SmVmZQ==) key modes.

A Keyed-Hash Message Authentication Code (HMAC) proves both data integrity (the payload was not altered in transit) and authenticity (the sender holds the shared secret key). Reproducing a provider's signature requires matching three exact parameters: the underlying hash primitive, the raw byte decoding of the secret key, and the exact byte sequence of the signed payload.

Example 1: IETF RFC 2104 / RFC 2202 / RFC 4231 Test Case 2

Whether you enter the 4-byte secret key as UTF-8 text Jefe, raw hexadecimal 4a656665, or Base64 SmVmZQ==, it decodes to the identical key buffer [0x4a, 0x65, 0x66, 0x65]. Signing the 28-byte UTF-8 message what do ya want for nothing? yields:

{
  "keyUtf8": "Jefe",
  "keyHex": "4a656665",
  "keyBase64": "SmVmZQ==",
  "message": "what do ya want for nothing?",
  "signatures": {
    "hmac_md5_hex": "750c783e6ab0b503eaa86e310a5db738",
    "hmac_sha1_hex": "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79",
    "hmac_sha256_hex": "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843",
    "hmac_sha256_base64": "W9zBRr9gdU5qBCQmCJV1x1oAPwidJzmDnexYuWTsOEM=",
    "hmac_sha256_base64url": "W9zBRr9gdU5qBCQmCJV1x1oAPwidJzmDnexYuWTsOEM",
    "hmac_sha384_hex": "af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649",
    "hmac_sha512_hex": "164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737"
  }
}

Example 2: Base64 vs Base64URL and Webhook Canonical Payloads

Standard Base64 (RFC 4648 Section 4) emits +, /, and trailing = padding, whereas URL-safe Base64URL (RFC 4648 Section 5, used in JWS/JWT signatures and signed URLs) substitutes - for +, _ for /, and strips = padding. Signing The quick brown fox jumps over the lazy dog with UTF-8 key key under HMAC-SHA256 illustrates the encoding difference directly:

Key (UTF-8):     key
Message (UTF-8): The quick brown fox jumps over the lazy dog

HMAC-SHA256 Hex:       f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8
HMAC-SHA256 Base64:    97yD9DBThCSxMpjmqm+xQ+9NWaFJRhdZl0edvC0aPNg=
HMAC-SHA256 Base64URL: 97yD9DBThCSxMpjmqm-xQ-9NWaFJRhdZl0edvC0aPNg

When verifying real-world webhook headers, construct the exact pre-signing payload defined by each provider before stripping header prefixes:

GitHub (X-Hub-Signature-256: sha256=<hex>):
  Signed input = <raw_http_body>

Stripe (Stripe-Signature: t=1730419200,v1=<hex>):
  Signed input = 1730419200.<raw_http_body>

Slack (X-Slack-Signature: v0=<hex>):
  Signed input = v0:1730419200:<raw_http_body>

Shopify (X-Shopify-Hmac-Sha256: <base64>):
  Signed input = <raw_http_body>

RFC 2104 Construction, Key Normalization Rules, and Timing-Attack Resistance

Quick Answer: RFC 2104 defines HMAC as H((K_0 XOR opad) || H((K_0 XOR ipad) || m)), normalizing secret keys against the hash function's internal compression block size B (64 bytes for MD5/SHA-1/SHA-256; 128 bytes for SHA-384/SHA-512) rather than its digest output length L.

Defined in IETF RFC 2104 and NIST FIPS 198-1, HMAC wraps any iterative cryptographic hash function H in a nested two-pass envelope that prevents Merkle-Damgard length-extension attacks:

HMAC(K, m) = H( (K_0 XOR opad) || H( (K_0 XOR ipad) || m ) )

Block Size (`B`) vs Output Length (`L`) and Key Normalization

A frequent implementation mistake in custom HMAC code is normalizing the secret key K against the digest output byte length L instead of the compression block byte length B:

  • MD5 (L = 16), SHA-1 (L = 20), SHA-256 (L = 32): Internal block size B = 64 bytes (512 bits).
  • SHA-384 (L = 48), SHA-512 (L = 64): Internal block size B = 128 bytes (1024 bits).

Before XORing against ipad (0x36 repeated B times) and opad (0x5c repeated B times), the raw key bytes K are normalized into an exact B-byte block K_0:

  1. Short keys (len(K) < B): Append B - len(K) zero bytes (0x00) to the right of K.
  2. Block-aligned keys (len(K) == B): Use K unmodified (K_0 = K).
  3. Oversized keys (len(K) > B): Hash K once using H(K) to produce an L-byte digest, then append B - L zero bytes (0x00) to reach B bytes.

Per RFC 2104 Section 3, secret keys should contain at least L bytes of cryptographic entropy (>= 32 CSPRNG bytes for HMAC-SHA256, >= 64 CSPRNG bytes for HMAC-SHA512). Keys shorter than L reduce effective brute-force security below the hash's birthday bound.

Key Encoding Pitfalls and Constant-Time Verification

  • Hex String vs Raw Hex Bytes: If an API issues a 64-character hex secret such as 4a656665..., check whether their SDK treats that string as 64 ASCII UTF-8 bytes (0x34 0x61...) or hex-decodes it into 32 raw bytes (0x4a 0x65...) before calling importKey. Toggling the Key Encoding selector between UTF-8, Hex, and Base64 immediately isolates key-decoding mismatches during integration debugging.
  • Constant-Time Verification: Never validate an untrusted MAC in server code using standard string equality (computedHex === headerHex). Standard string comparison returns false on the first mismatched byte, creating a nanosecond-scale timing oracle that lets remote attackers brute-force valid MACs one byte at a time (256 * L guesses instead of 2^(8*L)). Browser verification uses crypto.subtle.verify('HMAC', cryptoKey, signatureBuffer, messageBuffer) (or fixed-length bitwise XOR accumulation across decoded byte arrays), mirroring Node.js crypto.timingSafeEqual and Python hmac.compare_digest.

HMAC Generator vs Cryptographic Hash Generator vs JWT Generator: Which One Do You Need?

Quick Answer: Use HMAC Generator to sign or verify raw payloads (HTTP bodies, canonical strings, webhook events) with a shared secret key. Use Cryptographic Hash Generator for unkeyed string or file digests, and use JWT Generator to build structured RFC 7519 JSON Web Tokens signed with HS256, HS384, or HS512.

While unkeyed digests, raw HMACs, and symmetric JSON Web Tokens share underlying SHA-2 primitives, they solve distinct layers of protocol security:

Feature HMAC Generator & Verifier (This Tool) Cryptographic Hash Generator JWT Generator
Cryptographic Primitive Keyed MAC (RFC 2104 / FIPS 198-1) Unkeyed Digest (FIPS 180-4 / RFC 1321) JWS / JWT Token Envelope (RFC 7515 / RFC 7519)
Requires Secret Key Yes (UTF-8, Hex, or Base64 shared secret) No Yes (Symmetric secret or RSA/ECDSA keypair)
Security Guarantee Authenticity + Data Integrity Accidental / Public Data Integrity Only Authenticated Structured Claims (iss, sub, exp)
Supported Algorithms HMAC-SHA256, SHA384, SHA512, SHA1, MD5 MD5, SHA-1, SHA-256, SHA-384, SHA-512 HS256, HS384, HS512 (plus asymmetric JWS suites)
Output Format Hex, Base64, Base64URL Lower/Upper Hex, Base64 <header>.<payload>.<signature> (Base64URL)

Choosing the Right Utility

  • Debugging unkeyed file digests, W3C SRI hashes, or ETag / cache keys? No secret key is involved—use Cryptographic Hash Generator.
  • Building or inspecting bearer authentication tokens (HS256, HS384, HS512)? Under RFC 7515, a HS256 JWT signature is strictly the unpadded Base64URL output of HMAC-SHA256(secret, ASCII(BASE64URL(header) + "." + BASE64URL(payload))). While you can verify the raw third segment directly here by pasting <base64url_header>.<base64url_payload> as the message and selecting Base64URL output, use JWT Generator to edit JSON headers, validate exp/nbf timestamps, and assemble complete three-part tokens.
  • Symmetric HMAC vs Asymmetric Signatures: Because HMAC is symmetric, every service that verifies a signature holds the exact secret needed to forge new signatures. Use HMAC for point-to-point webhooks and trusted internal services; when untrusted third parties must verify tokens without signing privileges, use asymmetric keys (RS256, ES256, EdDSA) in JWT Generator.
FAQ

HMAC Generator & Verifier FAQ and Technical Guide

Everything you need to know about using Utiliome's free online hmac generator.

Why does my webhook HMAC verification fail even when my secret key and JSON fields look identical?

Two issues cause over 90% of webhook HMAC mismatches. First, middleware like Express express.json() parses and re-serializes JSON, altering whitespace, Unicode escaping, or key ordering relative to the raw TCP byte stream the sender signed—always sign the raw unparsed request buffer, and include provider timestamp prefixes (such as Stripe's <timestamp>.<body> or Slack's v0:<timestamp>:<body>). Second, check whether the provider's secret must be decoded from Base64 or Hex into raw bytes rather than read as a UTF-8 string.

Why is SHA256(secret + message) insecure compared to RFC 2104 HMAC-SHA256?

MD5, SHA-1, SHA-256, and SHA-512 use the Merkle-Damgard construction, whose final digest exposes the complete internal compression state. Given SHA256(secret || message) and the byte length of secret, an attacker can compute SHA256(secret || message || padding || attacker_suffix) without ever knowing secret (a length-extension attack). RFC 2104 HMAC eliminates this by feeding the inner digest into a second keyed outer hash H((K_0 XOR opad) || inner_hash).

What happens if my HMAC secret key is longer than 64 or 128 bytes?

Per RFC 2104 Section 2, if a secret key strictly exceeds the hash function's internal block size B (len(K) > 64 bytes for MD5, SHA-1, and SHA-256; len(K) > 128 bytes for SHA-384 and SHA-512), the key is first compressed by hashing it once with H(K) into L bytes and then right-padded with 0x00 bytes up to B bytes. Both Web Crypto (crypto.subtle.importKey) and RFC-compliant server libraries perform this pre-hashing step automatically.

Which output encoding should I select for GitHub, Stripe, Slack, Shopify, and JWT HS256?

GitHub (X-Hub-Signature-256), Stripe (Stripe-Signature v1), and Slack (X-Slack-Signature v0) all transmit lowercase Hex HMAC-SHA256 digests after their respective sha256=, v1=, or v0= prefixes. Shopify (X-Shopify-Hmac-Sha256) and AWS Signature v1/v2 use standard padded Base64. JSON Web Tokens (HS256, HS384, HS512) require unpadded Base64URL per RFC 7515—see JWT Generator for full token assembly.

Are HMAC-MD5 and HMAC-SHA1 broken by MD5 and SHA-1 collision attacks?

Not directly. Collision attacks against unkeyed MD5 and SHA-1 rely on an attacker freely choosing message blocks against a public fixed IV, whereas HMAC masks the internal IV behind secret K_0 XOR ipad and K_0 XOR opad steps (documented in IETF RFC 6151). Nonetheless, NIST SP 800-131A and major webhook providers (such as GitHub retiring X-Hub-Signature SHA-1) deprecate HMAC-MD5 and legacy HMAC-SHA1 for new systems—always choose HMAC-SHA256 or HMAC-SHA512 unless maintaining legacy protocol compatibility.