Loading your tools...
Loading your tools...
Securely generate Hash-based Message Authentication Codes using secret keys and standard hashing algorithms like SHA-256 and MD5.
The secret key is used to sign the message.
All computations happen directly in your browser. Your message and secret key never leave your device.
Supports standard algorithms like SHA-256 (standard for JWTs) and legacy MD5 for compatibility.

**Enter Message**: Type or paste the plain text string you want to authenticate.
**Enter Secret Key**: Input your secret signing key. This is used to generate the unique signature.
**Select Algorithm**: Choose a hashing algorithm. **SHA-256** is the industry standard for most modern APIs.
**Copy Result**: Get your HMAC signature in **Hexadecimal** or **Base64** format instantly.

HMAC (Hash-based Message Authentication Code) is defined in **RFC 2104**. It's more than just `hash(key + message)`, which is vulnerable to "length extension attacks". Instead, HMAC uses a nested hashing structure:
| Feature | Simple Hash (SHA-256) | HMAC | Digital Signature (RSA) |
|---|---|---|---|
| Data Integrity | Yes | Yes | Yes |
| Authentication | No (Anyone can hash) | Yes (Shared Secret) | Yes (Private Key) |
| Key Type | None | Symmetric (Shared) | Asymmetric (Public/Private) |
| Performance | Very Fast | Fast | Slow |
How to generate a SHA-256 HMAC in popular programming languages:
const crypto = require('crypto');
const secret = 'my-secret-key';
const message = 'Hello World';
const hmac = crypto.createHmac('sha256', secret)
.update(message)
.digest('hex');
console.log(hmac);import hmac import hashlib secret = b'my-secret-key' message = b'Hello World' hash = hmac.new(secret, message, hashlib.sha256).hexdigest() print(hash)
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
String secret = "my-secret-key";
String message = "Hello World";
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256");
sha256_HMAC.init(secret_key);
byte[] hash = sha256_HMAC.doFinal(message.getBytes());$secret = 'my-secret-key';
$message = 'Hello World';
$hash = hash_hmac('sha256', $message, $secret);
echo $hash;