Hashes/Crypto

HMAC Generator

Compute HMAC (Hash-based Message Authentication Code) of text or a file with a secret key — eight algorithms at once: MD5, SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-512, RIPEMD-160.

HMAC (Hash-based Message Authentication Code) is a hash computed together with a secret key, proving a message hasn't changed and was sent by someone who knows that key. Unlike a plain hash, an HMAC can't be forged without knowing the secret.

How to use it

Common uses

Things to keep in mind

HMAC protects against tampering and confirms the sender's authenticity, but it doesn't encrypt the message itself — the content stays readable.

A mismatched HMAC is most often caused by different data encoding (e.g. JSON field order) or a stray whitespace or line break, not by a bug in the algorithm itself.

Article about this tool: HMAC: how a keyed hash differs from a regular hash

Frequently asked questions

What's the difference between HMAC and a plain hash?

A plain hash only proves data wasn't altered; HMAC additionally uses a secret key, so it proves both integrity and that the sender knew the shared secret — someone without the key can't produce a valid HMAC even if they know the algorithm.

Which hash algorithm should I pick for HMAC?

HMAC-SHA256 is a solid modern default. Older choices like HMAC-MD5 or HMAC-SHA1 are still not broken as HMACs specifically, but SHA-256 or stronger is recommended for new systems.

Is my secret key sent anywhere?

No. The HMAC is computed entirely in your browser via the Web Crypto API — the key and message never leave your device.

Why can't I compare an HMAC using a plain equality operator?

A plain string comparison stops at the first mismatch, and its execution time leaks to an attacker how many leading characters they guessed correctly (a timing attack). You need a constant-time comparison function, such as hash_equals in PHP.

Can I reuse the same key for several different purposes?

It's not recommended. If the same secret key is used both to sign webhooks and for another purpose, compromising one system automatically compromises the other — generate a separate key for each distinct purpose.

Articles: Hashes/Crypto

Hash Generator: how MD5, SHA-1, and SHA-256 differ from each other

Why MD5 is still used to verify file integrity, but not for passwords.

Checksum Verifier: how to check that a file isn't corrupted

Why a matching checksum confirms a file's integrity, but not who created it.

Bcrypt: why passwords are hashed slowly, not quickly

Why fast SHA-256 is a bad choice for passwords, and slow bcrypt is the right one.

UUID: how identifiers that almost never repeat are generated

Why UUID v4 can be generated independently on millions of machines without collision risk.

Password Generator: what actually makes a password strong

Why a long dictionary-word password is stronger than a short one with symbols and digits.

AES: how symmetric encryption works

Why the same key both encrypts and decrypts data in AES, and how that differs from asymmetric encryption.

Argon2: why this algorithm won the password hashing competition

How Argon2 defends better against GPU-based attacks than older password hashing algorithms.

Scrypt: why the algorithm needs so much memory

Why scrypt deliberately demands a lot of memory to make cracking on ASIC devices harder.

TOTP: how one-time codes in authenticator apps work

Why the code in Google Authenticator works offline and syncs with the server only via time.

PBKDF2: the oldest key-stretching standard

Why the recommended PBKDF2 iteration count keeps growing every year.

X.509: what's inside an SSL certificate

What exactly the browser checks in a site's certificate before showing the green padlock.

PGP: how public-key and private-key encryption works

Why you can freely share a PGP public key but never the private one.