RevealTheme logo

HMAC生成器

使用SHA-1、SHA-256、SHA-384或SHA-512生成HMAC签名。

如何使用本工具

  1. 1

    Pick a hash algorithm from the dropdown: SHA-1, SHA-256, SHA-384, or SHA-512.

  2. 2

    Type or paste your shared secret key into the key field.

  3. 3

    Type or paste the message you want to authenticate into the message box.

  4. 4

    Click Generate to compute the HMAC; the lowercase hex digest appears below.

什么是HMAC生成器?

HMAC(Hash-based Message Authentication Code,基于哈希的消息认证码)使用共享的密钥来验证消息的完整性和真实性。它是webhook签名、API请求签名(AWS Signature V4、Stripe的webhook)以及JWT的HS256/HS384/HS512算法的基础。

常见使用场景

  • Verify an incoming webhook by recomputing the HMAC of the raw request body with your endpoint's signing secret and comparing it to the provider's signature header.

  • Check a Stripe webhook locally: HMAC-SHA256 the timestamped payload with your whsec_ secret to confirm your verification logic before deploying.

  • Debug a mismatched signature by pasting the exact bytes your server and client each signed to see which side is wrong.

  • Generate a quick integrity tag for a config file or message so a teammate with the same key can confirm it was not altered in transit.

  • Teach or learn how HMAC differs from a bare hash by toggling algorithms and watching the digest length change.

  • Sanity-check a single HMAC step of a larger signing scheme (such as one round of the AWS SigV4 key-derivation chain) during development.

常见问题

HMAC和哈希是一回事吗?
不是。任何人都能计算出简单的哈希值(如SHA-256)。HMAC则需要一个密钥:没有它,你既无法验证也无法伪造签名。

相关工具