โ† Back to blog

Choosing Hash Algorithms for Checksums

SHA-256 vs MD5 vs HMAC for file and payload integrity. When a fast digest is enough, when MD5 is only legacy, and how to verify checksums without mixing password hashes.

A release notes page lists sha256: a3f1.... Someone on the team pastes the download into a chat, runs MD5 "because it is shorter," and declares the file good when the hex looks familiar. They checked the wrong algorithm against the wrong threat. The file was fine this time. The process was not.

This guide is for integrity work: download mirrors, cache keys, config drift, CI artifact labels, and "did this payload change?" It is not a password-storage tutorial. For that split, see Bcrypt vs SHA-256 for Passwords. Here the job is a checksum - a fast, deterministic fingerprint of bytes - and picking the primitive that matches what publishers and APIs actually publish.

Use throwaway samples. Prefer short fixture strings over production secrets or customer dumps.

What a checksum is for

PrimitiveTypical jobSame input twiceKeyed?Default for new integrity checks
SHA-256File / payload fingerprintIdentical 64-char hexNoYes
MD5Legacy labels, old mirrors, etagsIdentical 32-char hexNoNo
HMAC-SHA-256Prove a shared secret signed this messageIdentical for same key+messageYesFor authenticity, not bare checksums
bcryptPassword KDFDifferent each time (salt)Built-in saltNever for checksums

A checksum answers: "Would another copy of these bytes produce the same digest?" It does not answer "who sent this?" or "is this password safe to store?" Mixing those questions is how MD5 ends up in a users table and how bcrypt ends up in a download page.

If a vendor publishes a SHA-256, verify SHA-256. If an ancient API still returns MD5, speak MD5 for that wire format only - then prefer SHA-256 for anything you control.

Pitfall 1: MD5 because the hex is shorter

MD5 looks convenient: 32 hex characters instead of 64. That is a display preference, not a security or integrity upgrade. MD5 is collision-broken. Attackers can craft different inputs with the same MD5. For casual "did I copy the string wrong?" checks in a trusted lab, that may not matter. For public download verification, software updates, or anything adversarial, it does.

Typical scene: A mirror publishes both digests. The ticket says "checksum matched" with an MD5 the attacker also matched. The SHA-256 would have failed.

What to do: Default new checksums to SHA-256. Generate a fixture in SHA256 Generator, then confirm with Hash Checker. Reach for MD5 Generator only when a partner system, RFC, or old cache key still requires it.

Pitfall 2: Comparing the wrong digest format

People fail verification for boring reasons:

  • Algorithm mismatch (SHA-256 hex checked as MD5, or the reverse)
  • Extra whitespace, sha256: prefixes, or newlines copied from a README
  • Uppercase vs lowercase hex (most tools treat hex case-insensitively; your one-off script may not)
  • Hashing the wrong bytes (UTF-8 text of a filename instead of file contents; Windows CRLF vs LF)

Typical scene: Support says "Hash Checker says mismatch." The published line was SHA256 (file.zip) = ABCD... and someone pasted the whole line, or hashed a text export that rewrapped the binary.

What to do: Copy only the hex. Select the algorithm the publisher named. In Hash Checker, paste the same text you hashed and the expected digest, choose SHA-256 or MD5, click Verify. If you built the digest yourself, generate once in SHA256 Generator or MD5 Generator, copy the hex, then verify in Hash Checker so you trust the round trip before you trust a partner file.

Pitfall 3: Treating HMAC like a plain checksum

HMAC (Hash-based Message Authentication Code) folds a secret key into the digest. Same message, different key, different hex. That is the point for webhook signatures and API request auth. It is the wrong tool when you only need a public fingerprint anyone can recompute.

Typical scene: A team "secures" a download page by publishing an HMAC of the file with a key shipped in the frontend. Anyone who can read the page can forge the tag. Or the inverse: they store bare SHA-256 of a webhook body and wonder why forgeries verify.

What to do: Public integrity label -> SHA-256 (or MD5 only for legacy). Shared-secret authenticity -> HMAC Generator with a server-side secret, never a key baked into a client bundle. If you are choosing between password hashing and digests, bcrypt still does not belong in this checklist - see the password guide linked above.

Pitfall 4: Truncating hashes "for readability"

Short prefixes (abc123...) are fine as UI hints. They are not substitutes for full digests in verification scripts. Truncation raises collision odds and breaks interoperability with published full-length checksums.

Typical scene: A CI job compares the first 8 hex characters and ships a tainted artifact that collided in the prefix. Or a docs page prints a truncated value and support cannot match Hash Checker output.

What to do: Store and compare the full SHA-256 hex (64 characters) or full MD5 hex (32 characters). Truncate only in logs meant for humans, and label them as prefixes.

Pitfall 5: Using a password hash as a file fingerprint

Bcrypt (and Argon2) deliberately change with every salt and burn CPU. That is correct for passwords and useless for "same zip twice." Two bcrypt strings for the same file contents will not match with ===, and Hash Checker will not verify $2b$... as SHA-256.

Typical scene: Someone "upgrades" release checksums to bcrypt after reading a password article. Installers cannot recompute a stable label. Reviews reject the change for the right reason: wrong primitive.

What to do: Keep Bcrypt Generator for credential fixtures. Keep SHA-256 / MD5 / Hash Checker for integrity. Speed is a feature of checksums; slowness is a feature of password KDFs.

A checksum decision checklist

  1. Name the job. Unkeyed "did bytes change?" -> SHA-256. Legacy wire format that demands MD5 -> MD5 for that interface only. "Did someone with the secret produce this?" -> HMAC.
  2. Match the published algorithm. Do not invent a second digest and call the first one wrong.
  3. Hash the same bytes. Agree on encoding, line endings, and whether you hash the file or a text dump of metadata.
  4. Compare full hex. Strip labels and whitespace; keep the entire digest.
  5. Do not store passwords as checksums. Fast digests belong in download pages and cache keys, not in users.password.
  6. Keep production verification in your pipeline. Browser tools are for teaching, fixtures, and catching copy-paste mistakes before you change CI.

How the Utilitoo tools fit

Reproduce the decision with disposable input:

  1. Pick a short fixture string, for example utilitoo-checksum-demo-v1.
  2. Paste it into SHA256 Generator and generate. Copy the 64-character hex. Generate again - same hex. That stability is what release notes rely on.
  3. Paste the text plus the hex into Hash Checker, select SHA-256, click Verify - match. Change one character of the text - mismatch.
  4. Run the same text through MD5 Generator. You get a different, shorter hex. Verifying that MD5 as SHA-256 in Hash Checker fails. That is algorithm mismatch, the same class of bug as checking the wrong column in a vendor README.
  5. Optional: sign the message in HMAC Generator with a throwaway key. Change the key, keep the message - digest changes. That is authenticity, not a public checksum.

Everything runs in the browser. Still avoid pasting customer data or production signing keys on a shared screen.

Common mistakes

MistakeWhat goes wrongBetter habit
MD5 for new public downloadsCollision risk; looks "verified" when it is notPublish and verify SHA-256
Checking SHA-256 hex as MD5False mismatch or false confidenceMatch the named algorithm
Pasting sha256: prefixes into the hex fieldParse / compare failuresHex only
Truncating digests in CIPrefix collisionsFull-length compare
HMAC with a public client keyForgeable "signature"Server-side secret, or bare SHA-256 if public
Bcrypt as a file checksumNon-deterministic, wrong toolSHA-256 for integrity
Hashing filename text instead of contentsGreen check, wrong fileHash the bytes you ship

Bottom line

For checksums, SHA-256 is the default fingerprint. MD5 is a compatibility debt. HMAC adds a secret for authenticity. Bcrypt is a different job entirely. Pick the primitive that matches the question on the ticket - "did these bytes change?" is not "can we store this password?" and not "did our server sign this webhook?"

Utilitoo's SHA256 Generator, MD5 Generator, Hash Checker, and HMAC Generator are for rehearsing that choice on a sample string before the release notes, the mirror, or the CI compare go live.

Try these tools