Guide

Hashing, HMAC & Checksums Explained

What cryptographic hashes are, how MD5/SHA-1/SHA-2/SHA-3 compare, how HMAC adds authenticity, why passwords need bcrypt/Argon2, and checksums for file integrity.

Last updated: 26 July 2026

A cryptographic hash turns any input — a word, a file, a gigabyte of video — into a short, fixed-size fingerprint called a digest. It’s one of the most useful primitives in computing: it powers integrity checks, digital signatures, webhooks, version control and password storage. This guide explains what hashing is, which algorithms to trust, and how HMAC and password hashing differ from plain hashing.

What a cryptographic hash is

A good cryptographic hash function has these properties:

Crucially, hashing is not encryption (encryption is reversible with a key) and not encoding (encoding like Base64 is reversible by anyone). A hash throws information away on purpose — there is no key and no way back.

The hash families

MD5 (1992) and SHA-1 (1995) are considered broken for collision resistance. Practical collision attacks exist for both, so they must not be used for signatures, certificates or any security decision. They survive only as fast, non-adversarial checksums and legacy hash-table keys.

SHA-2 (2001) — the family SHA-224/256/384/512 — is the current default. SHA-256 is the everyday workhorse; SHA-384/512 offer larger digests. No practical attacks exist, and it’s what you should reach for unless you have a specific reason not to.

SHA-3 (2015) is a newer standard built on a completely different internal design (the Keccak sponge construction). It’s not a replacement for SHA-2 but a diversified alternative in case a future weakness is found in SHA-2’s structure.

BLAKE2 / BLAKE3 also exist — modern, extremely fast hashes that are as secure as SHA-2/3 and popular where raw speed matters (e.g. BLAKE3 for large-file hashing).

Comparison

Algorithm Output size Status Typical use
MD5 128-bit Broken (collisions) Legacy checksums only — never for security
SHA-1 160-bit Broken (collisions) Legacy; git object IDs (being migrated)
SHA-256 256-bit Secure Default for integrity, signatures, checksums
SHA-384 / 512 384 / 512-bit Secure Higher-security signatures, TLS
SHA-3 (256/512) 256 / 512-bit Secure Alternative to SHA-2, defence in depth
BLAKE2 / BLAKE3 variable Secure High-speed hashing, large files

HMAC — keyed hashing for authenticity

A plain hash proves integrity (the data wasn’t changed) but not authenticity (who sent it) — anyone can recompute a plain hash over tampered data. HMAC (Hash-based Message Authentication Code) fixes this by mixing a secret key into the hashing process.

Only someone holding the shared secret can produce a valid HMAC, so the recipient knows the message is both intact and from a trusted sender. HMAC is written as HMAC-SHA256, HMAC-SHA1, etc., naming the underlying hash. You’ll meet it in:

Note that HMAC is not the same as simply hashing key + message; its two-pass construction (defined in RFC 2104) is specifically designed to resist length-extension and related attacks.

Password hashing is different

Do not hash passwords with SHA-256. General-purpose hashes are built to be fast, and speed is exactly what an attacker wants — a stolen database of SHA-256 hashes can be brute-forced at billions of guesses per second on a GPU.

Password storage needs purpose-built, slow, salted functions:

Two ideas make these work:

Checksums for file integrity

A checksum is just a hash used to verify that a file downloaded or copied without corruption or tampering. Projects publish a SHA256SUMS file; you hash your downloaded copy and compare:

sha256sum ubuntu.iso
# compare the output against the published SHA-256 sum

If the digests match, the file is intact. Use SHA-256 for this — MD5/SHA-1 sums still appear on some sites but only guard against accidental corruption, not a malicious swap.

Best practices

References

Try it: generate digests and signatures right in your browser with the Hash, HMAC and MD5 tools — everything runs client-side via the Web Crypto API.

Frequently asked questions

Is hashing reversible?

No. A cryptographic hash is a one-way function — you cannot recover the input from the digest. That's the whole point. People "crack" weak hashes only by guessing inputs and re-hashing them (brute force / rainbow tables), not by reversing the maths. Hashing is not encryption, which is designed to be reversed with a key.

Is MD5 safe to use?

Not for anything security-related. MD5 (and SHA-1) are broken for collision resistance — attackers can craft two different inputs with the same digest. They're fine only for non-adversarial uses like a quick checksum or hash-table key. For integrity or signatures, use SHA-256 or better.

What's the difference between hashing, encryption and encoding?

Encoding (Base64, hex) is reversible with no key and adds no secrecy. Encryption (AES, RSA) is reversible only with a key and provides confidentiality. Hashing (SHA-256) is one-way and not reversible — it produces a fixed-size fingerprint used for integrity and verification.

How should I hash passwords?

Never with a plain SHA. Use a slow, salted password-hashing function designed for the job — Argon2id (preferred), scrypt or bcrypt. These are deliberately slow and memory-hard so brute-forcing stolen hashes is expensive, and they salt each password so identical passwords produce different hashes.

Is my input uploaded when I use the hash tools?

No. The hashing tools on this site run entirely in your browser using the Web Crypto API. Nothing you type or drop is sent to a server.

Related tools