Compute Hash-Based Message Authentication Code (HMAC) using industry-standard hash functions. Verify message integrity and authenticity with a shared secret — fully client-side.
HMAC (Hash-based Message Authentication Code) is a mechanism for verifying both the integrity and authenticity of a message using a shared secret key. Unlike ordinary hash functions (MD5, SHA-256) which only ensure data hasn't been accidentally corrupted, HMAC protects against deliberate tampering because an attacker without the secret key cannot produce a valid MAC. Defined in RFC 2104 and FIPS PUB 198-1, HMAC is widely adopted in API authentication (AWS Signature V4), JWT (with HS256), webhook security, and secure banking protocols.
HMAC(K, m) = H((K ⊕ opad) ∥ H((K ⊕ ipad) ∥ m))
Where H is a cryptographic hash function (SHA-256, etc.), K is the secret key padded to block size, ipad/opad are inner/outer padding constants. This construction prevents length extension attacks and provides proven security reduction to the underlying hash.
| Algorithm | Output Length | Security Status | Recommended Use |
|---|---|---|---|
| HMAC-MD5 | 128 bits | Broken / collision vulnerable | Avoid; legacy compatibility only |
| HMAC-SHA1 | 160 bits | Theoretically weak (deprecated) | Not recommended for new systems |
| HMAC-SHA256 | 256 bits | Secure (standard) | Default choice for most applications |
| HMAC-SHA512 | 512 bits | Extremely secure | High-security environments, compliance |
NIST SP 800-107 recommends HMAC with SHA-256 or stronger for all new deployments. For API signing, always use at least SHA-256 and a key of equal or larger bit strength.
E-commerce platforms like Shopify or Stripe send webhook events (e.g., "payment succeeded") to merchant endpoints. To verify the webhook truly originated from the provider, they include an HMAC-SHA256 signature header computed using a shared secret. The merchant recomputes the HMAC locally using the received payload and secret; if signatures match, the event is authentic. Our tool replicates this exact logic — developers can test payloads and secrets before integration.