ToolGrid — Product & Engineering
Leads product strategy, technical architecture, and implementation of the core platform that powers ToolGrid calculators.
AI Credits in development — stay tuned!AI Credits & Points System: Currently in active development. We're building something powerful — stay tuned for updates!
Loading...
Preparing your workspace
Generate HMAC (Hash-based Message Authentication Code) signatures using various hash algorithms (SHA-256, SHA-512, SHA-1, MD5) for API authentication, message integrity verification, and secure request signing.
Note: AI can make mistakes, so please double-check it.
Never share your secret key or commit it to version control. HMAC signatures are only as secure as your secret key.
Common questions about this tool
HMAC (Hash-based Message Authentication Code) combines a secret key with a message and hashes them together. It provides both authentication (verifies the sender) and integrity (detects tampering), making it ideal for API security and secure communications.
Use SHA-256 for most applications as it provides good security and performance. SHA-512 offers higher security for sensitive applications. Avoid MD5 and SHA-1 for new applications as they're considered cryptographically weak.
Generate an HMAC signature using your secret key and request data (URL, method, body, timestamp). Include the signature in your API request headers. The server recalculates the HMAC and verifies it matches, authenticating the request.
Yes, you can verify HMAC signatures by recalculating the HMAC with the same message and secret key. If the calculated signature matches the provided signature, the message is authentic and hasn't been tampered with.
Yes, HMAC is widely used for API authentication (AWS, GitHub, Stripe use HMAC-SHA256). It's secure when used with strong secret keys, proper key management, and HTTPS for transmission. Always use SHA-256 or stronger algorithms.
Verified content & sources
This tool's content and its supporting explanations have been created and reviewed by subject-matter experts. Calculations and logic are based on established research sources.
Scope: interactive tool, explanatory content, and related articles.
ToolGrid — Product & Engineering
Leads product strategy, technical architecture, and implementation of the core platform that powers ToolGrid calculators.
ToolGrid — Research & Content
Conducts research, designs calculation methodologies, and produces explanatory content to ensure accurate, practical, and trustworthy tool outputs.
Based on 2 research sources:
Learn what this tool does, when to use it, and how it fits into your workflow.
The HMAC Generator creates Hash-based Message Authentication Code (HMAC) signatures from a message and a secret key. It supports multiple algorithms including SHA-256, SHA-512, SHA-1, and MD5, and can output the result in hexadecimal or Base64 format.
HMACs are used to prove that a message came from someone who knows a secret key and that the message was not changed in transit. They are common in API authentication, webhook signatures, and secure request signing. Setting them up by hand can be confusing because there are many details: which algorithm to use, how to format the message, and how to treat whitespace.
This tool simplifies that work. It lets you enter a message and secret key, pick the algorithm and output format, and see the HMAC update automatically as you type. It includes predefined test vectors from standards documents and API examples, an optional AI troubleshooting helper, and safety checks for long inputs.
The HMAC Generator is intended for developers, security engineers, DevOps staff, and technical users working with signed requests. A beginner with some familiarity with APIs can still use it thanks to clear labels and built-in presets.
HMAC stands for Hash-based Message Authentication Code. It combines a cryptographic hash function (such as SHA-256) with a secret key. The basic idea is that the sender and receiver share a key. The sender computes an HMAC over the message using the key and sends both message and HMAC. The receiver re-computes the HMAC using the same key and message. If the values match, the message is authentic and unmodified.
Unlike plain hashes, HMACs are keyed. Without the key, an attacker cannot easily produce a valid HMAC for a message. This property makes them useful for signing API requests, verifying webhooks, and protecting internal communication between services. Different algorithms have different strengths: SHA-256 and SHA-512 are strong modern choices, while SHA-1 and MD5 are considered weak for new designs but still appear in legacy systems.
In many API systems, the client builds a canonical string from request parts (method, path, headers, timestamp, body) and then computes an HMAC using a secret API key. The HMAC is often encoded in hex or Base64 and attached to the request as a header. The server rebuilds the same string and repeats the HMAC calculation. If any part of the request changes or the key is wrong, the HMAC changes.
However, reproducing these signatures by hand is hard. Extra spaces, line breaks, or differences in trimming can cause mismatches. Picking the wrong algorithm or output format also leads to confusion. The HMAC Generator gives you a clean, controlled environment where you can see all the moving parts: message, secret key, algorithm, normalization, and encoding.
trim() on both values.Reproducing an API signature: If an API call fails due to an invalid signature, you can paste the exact canonical message string and secret key into the tool, set the right algorithm and normalization, and compare your HMAC to what the server expects.
Debugging webhook verification: When verifying webhooks from services that use HMAC signatures, you can reconstruct the signing string and confirm that your tooling computes the same HMAC as the service. Differences show you where canonicalization may be wrong.
Learning HMAC mechanics: Students and new developers can use the test vectors to see how different algorithms produce different HMAC values for the same message and key. They can also learn how trimming affects the result.
Generating sample HMACs for tests: You can generate fixed HMAC values for given test messages and keys, then include them in unit tests or documentation so others can verify their own implementations.
Comparing algorithms and formats: By switching between SHA-256, SHA-512, SHA-1, and MD5 and toggling hex versus Base64 output, you can see how output length and structure differ between combinations.
The core calculation uses a hashing library to implement HMAC. The compute function first checks that message and key are non-empty strings and within allowed length limits. If the normalize flag is true, it trims both values with trim(); otherwise, it uses them as-is.
Based on the selected algorithm, the function calls the appropriate HMAC helper: HmacSHA256, HmacSHA512, HmacSHA1, or HmacMD5. Each helper takes the final message and key and returns an internal representation of the hash.
The function then checks the output format. If the format is Base64, it calls toString with a Base64 encoder to produce a Base64 string. If the format is hex, it calls toString without arguments or with the default hex encoder to produce a lowercase hex string.
The UI calls this compute function inside a try/catch. Any thrown error is caught and converted into a friendly error message for display. The HMAC is recomputed in a debounced effect whenever inputs change, which prevents excessive recalculation while the user is still typing.
The tool also uses helper functions to work with hex data and UTF-8 in other contexts. One helper checks if a string contains only hex digits, and another converts a hex string into a UTF-8 string using the hashing library’s encoders. These helpers are available for future features and analysis but are not directly exposed in the main UI.
The AI troubleshooting logic calls a backend helper with the current message, key, algorithm, and optional API name. The backend wraps an AI provider and returns plain text advice, which is then shown without further processing.
| Algorithm | Hash size | Typical usage |
|---|---|---|
| HMAC-SHA256 | 256 bits (32 bytes) | Default choice for modern APIs |
| HMAC-SHA512 | 512 bits (64 bytes) | High-security and high-entropy contexts |
| HMAC-SHA1 | 160 bits (20 bytes) | Legacy systems, not recommended for new designs |
| HMAC-MD5 | 128 bits (16 bytes) | Legacy verification only, not for security |
Use strong algorithms for new systems: Prefer HMAC-SHA256 or HMAC-SHA512 for new designs. Avoid MD5 and SHA-1 for anything security sensitive.
Keep secrets truly secret: Do not share secret keys, paste them into shared screens, or commit them to version control. Treat any key you test here as sensitive, especially on shared machines.
Match normalization behavior: Small differences in whitespace handling can cause mismatched signatures. Make sure the normalization toggle matches what your production code does.
Follow exact canonicalization rules: When working with complex APIs, follow their documentation on how to build the signing string. This tool assumes you have already built that string correctly.
Check algorithm and encoding: If signatures do not match, confirm that you are using the same hash algorithm and output encoding (hex or Base64) as the system you compare against.
Watch input sizes: Very long messages and keys may slow down calculations or may reflect unrealistic real-world usage. Keep values within reasonable lengths, especially when debugging.
Use test vectors for verification: When implementing HMAC in your own code, start by matching the RFC and API preset vectors from this tool. Once those match, move to your custom messages.
Do not reuse keys across systems: For good security hygiene, use distinct keys for different APIs or services. This limits the blast radius if one key ever leaks.
Treat AI advice as guidance: The AI troubleshooting panel can suggest common pitfalls and fixes, but you must still verify any changes in a safe test environment.
Protect production secrets: Consider using test keys or non-production messages when using browser tools. For real production debugging, rotate keys afterward or work within secure, controlled environments.
We’ll add articles and guides here soon. Check back for tips and best practices.
Summary: Generate HMAC (Hash-based Message Authentication Code) signatures using various hash algorithms (SHA-256, SHA-512, SHA-1, MD5) for API authentication, message integrity verification, and secure request signing.