格 千格 KiloCell

HMAC Generators

HMAC-SHA256 Signature
-

HMAC: Why is it a safe gold standard for API?

HMAC(Hash-based Message Authentication Code, based on Hashi message authentication code) is an authentication code formed by a specific Hashi algorithm, combined with an encryption key. It's not just about data. Integrity It's not altered. It's real. Identification (The data is indeed from the sender who holds the key.

HMAC vs Normal Hash (Hash)

Normal Hash algorithm (e.g. SHA-256 is public and established. If hackers intercept your messages and Hash values, they can modify the messages and recalculate a new Hash value to send to the server. And... HMAC has introduced only senders and receivers. Key (Secret Key) 。 Without the key, the attackers could not forge a legal signature, even if they had full Hashi algorithms.

The concrete scenes and the pains that were solved

  • Webhook Authentication: When GitHub or Stripe sends an event notification to your server, they will take an HMAC Signature. With this tool, you can quickly manually verify whether your receiving logic is correct in the interpretation of these signatures.
  • API requests permission: Many cloud services (e.g. AWS, Ariyun) require parameters to be sorted in dictionaries and HMAC Signature. When debugging such complex signature logic, this tool can serve as your “reference answer”.
  • JWT (JSON Web Tokens) debug: The first and second parts of JWT are the Base64 coded JSON, while the third part is the HMAC of the first two parts Signature. This tool will help you to verify the validity of Token manually.
  • Local debugging without the need for network: Safety is a primary consideration when dealing with sensitive API keys. All calculations for this tool are done in the browser memory. Never send your key to the Internet 。

HMAC Best Practices Recommendations

  1. Select a strong algorithm: Priority should be given unless it is compatible with the old system. HMAC-SHA256 or HMAC-SHA512 。 Avoiding the use of proven security risks MD5 。
  2. Key strength: The key should be at least the same length as the output of the Hash algorithm. It is recommended that a long string generated randomly be used as a key.
  3. Responsive attack: The signature message contains a time stamp (Timestamp) or a random number (Nonce) and validates its validity at the service end to prevent the assailant from intercepting and retransmitting a legitimate request.
  4. Periodically replace key: As with periodic password changes, regular rotation of API keys can effectively reduce the risk of leakage.

How to use this tool?

1. Configure Environment: Select the algorithm (usually SHA256) and output format (Hex is the most common, Base64 is often used in Header).

2. Enter data: Paste your Secret Key and the original message to sign. The tool updates the results in real time with your input.

3. Comparative validation: Compares the signature generated by this tool with the signature generated by your code. If different, check if the message is identical in spaces, line breaks or code.

ResultCopied