# HMAC Generator & Verifier

Compute an HMAC message-authentication signature over a message + shared secret using SHA-1/SHA-2/SHA-3/BLAKE2, or verify an incoming signature against the secret — with webhook presets for Stripe / Slack / GitHub and constant-time comparison

> Canonical page: https://test.elysiatools.com/en/tools/hmac-generator-verifier

- **Category:** Security

- **Keywords:** hmac, signature, webhook, stripe, slack, github, sha256, sha-2, sha-3, blake2, message authentication code, mac, verify, api signing, security

## Overview

HMAC (Hash-based Message Authentication Code) proves a message was sent by someone who knows the shared secret and was not tampered with — it is the standard signature mechanism behind Stripe, Slack, GitHub, Shopify and most other webhooks.

This tool supports two modes:

- **Generate**: paste the raw request body and your webhook secret, pick an algorithm (SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-512, BLAKE2s-256, BLAKE2b-512) and an output encoding (hex / base64 / base64url), and get the signature.
- **Verify**: additionally paste the signature you received in the webhook header; the tool recomputes the HMAC and compares it in constant time via `crypto.timingSafeEqual`.

Webhook presets auto-select the right algorithm, encoding and signature prefix for Stripe, Slack, and GitHub. Everything is computed locally with Node `crypto`; the secret never leaves the request.

## Inputs

- **Message (raw body)** (textarea): Paste the raw request body exactly as received (do not re-serialize JSON — byte differences break the signature).
- **Shared Secret** (text): whsec_... (your webhook signing secret)
- **Mode** (select)
- **Algorithm** (select)
- **Signature Encoding** (select)
- **Signature to verify** (text): Paste the signature from the webhook header (verify mode)
- **Webhook preset** (select)

## When to use

- When debugging or testing webhook integrations from platforms like Stripe, Slack, or GitHub that require HMAC signature verification.
- When generating secure API request signatures using shared secrets and hashing algorithms like SHA-256 or SHA-512.
- When verifying the integrity and authenticity of a payload received from a third-party service without exposing your shared secret to external servers.

## How it works

- Select your operation mode: either 'Generate only' to create a new signature, or 'Verify against signature' to validate an existing one.
- Input the raw request body (message) and your shared webhook secret, ensuring the payload is not re-serialized to avoid byte mismatches.
- Choose the hashing algorithm (such as SHA-256 or BLAKE2) and signature encoding (hex, base64, or base64url), or select a pre-configured webhook preset.
- The tool computes the HMAC locally using Node's crypto library and, if in verification mode, performs a constant-time comparison against your provided signature.

## Use cases

- Testing local webhook handlers by manually generating valid HMAC signatures for mock payloads.
- Troubleshooting failed webhook signature verifications by comparing computed signatures against received headers.
- Verifying API request authenticity during development using custom SHA-256 or SHA-512 HMAC configurations.

## Frequently asked questions

### Does this tool send my shared secret to a server?

No. All HMAC computations and signature verifications are performed locally in your browser using Node crypto APIs.

### Why does my generated signature not match the webhook signature?

Ensure you are pasting the exact raw request body. Re-serializing JSON or adding whitespace changes the byte sequence, which alters the HMAC output.

### What is constant-time comparison?

It is a security measure that compares signatures byte-by-byte at a constant speed, preventing attackers from using timing analysis to guess the signature.

### Which algorithms are supported?

The tool supports SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-512, BLAKE2s-256, and BLAKE2b-512.

### What do the webhook presets do?

They automatically configure the correct hashing algorithm, output encoding, and signature prefix format used by Stripe, Slack, or GitHub.

## Related tools

- [PKCE Code Verifier & Challenge Generator](https://test.elysiatools.com/en/tools/pkce-code-verifier-generator): Generate, validate and verify OAuth2 / OIDC PKCE (RFC 7636) code_verifier and S256 code_challenge pairs. Three modes: (1) generate a fresh verifier + challenge from cryptographically secure random bytes at 256/384/512/768-bit entropy, (2) audit a verifier you already have against the RFC — length (43–128), charset \[A-Za-z0-9-._~\] and ≥256-bit entropy, and (3) verify a verifier/challenge pair by recomputing BASE64URL(SHA256(verifier)). Optionally build the full authorization-request URL and token-exchange body. Complements the generic nonce-generator (which only emits a verifier+challenge pair) with RFC-compliance auditing and pair verification.
- [SSH Key Pair Generator](https://test.elysiatools.com/en/tools/ssh-key-generator): Generate an SSH key pair (Ed25519 recommended, RSA 4096, or ECDSA P-256) with an OpenSSH-format public key ready for ~/.ssh/authorized_keys, a SHA256 fingerprint, and a PEM private key. Optional passphrase encryption. Runs locally.
- [TOTP / HOTP Offline Code Generator](https://test.elysiatools.com/en/tools/totp-hotp-offline-generator): Generate RFC 6238 TOTP (time-based, 6/8 digits, 30/60s step) and RFC 4226 HOTP (counter-based) one-time passwords from a base32 shared secret, fully offline with HMAC-SHA1/256/512, plus an otpauth:// URI for importing into Google Authenticator / Authy
- [BIP39 Mnemonic Phrase Generator](https://test.elysiatools.com/en/tools/mnemonic-bip39-generator): Generate or validate 12 to 24 word BIP39 mnemonic phrases with entropy and PBKDF2-HMAC-SHA512 seed output
- [Kakuro / Fillomino / Masyu / Yajilin / Hashiwokakero / Nurikabe / Slitherlink / Star Battle Puzzle Generator with Uniqueness Prover](https://test.elysiatools.com/en/tools/kakuro-fillomino-masyu-yajilin-hashiwokakero-nurikabe-slitherlink-and-star-battle-puzzle-generator-with-uniqueness-prover): Deterministically seeded generator for eight Nikoli logic-puzzle families — each board is grown solution-first, rendered as puzzle + solution SVGs, and verified by an exhaustive backtracking solver that counts solutions to two, so “unique” is a proof (and an exhausted budget is reported as unproven, never guessed).
- [OAuth 2.0 / OIDC Authorization Code with PKCE Flow Visualizer](https://test.elysiatools.com/en/tools/oauth-oidc-authorization-code-pkce-flow-visualizer): Simulate the Authorization Code flow with PKCE end to end: verifier/challenge generation, authorization URL, token exchange, ID Token validation checklist and an interception-attack demo.
- [Argon2 Password Hash Generator](https://test.elysiatools.com/en/tools/argon2-password-hash-generator): Generate Argon2id password hashes with tunable memory, iterations, parallelism, salt length, and PHC output
- [Barcode Batch Generator](https://test.elysiatools.com/en/tools/barcode-batch-generator): Batch generate Code 128, EAN-13, UPC-A, ITF-14, QR Code, and Data Matrix outputs from CSV or multiline text

## Samples

- [Android Image Processing Java Samples](https://test.elysiatools.com/en/samples/android-image-processing-java): Android Java image processing examples including reading/saving images, scaling, and format conversion
- [Android Image Processing Kotlin Samples](https://test.elysiatools.com/en/samples/android-image-processing-kotlin): Android Kotlin image processing examples including reading/saving images, scaling, and format conversion
- [Web Image Processing Python Samples](https://test.elysiatools.com/en/samples/web-image-processing-python): Web Python image processing examples using PIL/Pillow including reading, saving, resizing, and format conversion
- [Web Image Processing Rust Samples](https://test.elysiatools.com/en/samples/web-image-processing-rust): Web Rust image processing examples including image read/save, scaling, and format conversion

## Related content

- [Authorized JWT, OTP, TOTP, and Session Test Workflow](https://test.elysiatools.com/en/hubs/token-session-and-2fa-workflows): Build sanitized auth fixtures, separate token generation from decoding and verification, test OTP/TOTP timing, and audit JWT and session evidence without exposing real secrets.
- [API Request Format, Replay Preparation, and Debugging Tools](https://test.elysiatools.com/en/hubs/api-request-replay-and-debugging): Check request structure, prepare a local replay, compare responses, and debug API clues. These tools analyze or generate locally and do not replace real authentication or server tests.
