← Guides

Developer Guide

Hash Functions for Data Integrity

Verify downloads with SHA-256 checksums and HMAC when you also need authenticity. SHA-1 is legacy; MD5 is omitted on purpose. Files never leave the browser.

file checksumsha256 checksumhmac authenticitysha-1 versus sha-256verify file integrity

A download page that lists SHA256 (foo.tar.gz) = … is giving you a fingerprint of the bytes. You hash the file you received and compare. Matching hex means the bits are the same as the publisher’s bits. It does not, by itself, mean the publisher is who you think — anyone who swapped the file could also swap a SHA-256 line on a page they control.

/tools/hash-generator computes SHA-1, SHA-256, SHA-384, and SHA-512 in the browser, from pasted text or a dropped local file. HMAC is optional when you share a secret with the sender. MD5 is intentionally absent.

Checksums for downloads

Publish the digest next to the artifact (or in a SHA256SUMS file). On the receiving side, drop the file onto /tools/hash-generator, select SHA-256, and compare hex. Toggle uppercase if the manifest uses A–F. Whitespace and a leading filename must not sneak into the text box — hash the file bytes, not a pasted name.

Git, container images, and lockfiles use the same idea: the digest is the identity of the content. Change one byte and the avalanche effect gives you an unrelated hex string.

SHA-256 versus SHA-1

SHA-256 is 256 bits (64 hex characters). SHA-1 is 160 bits (40 hex) and has practical collision attacks. For new checksums, publish SHA-256 or SHA-512. Keep SHA-1 only when you must match a legacy list (older Git objects, an old vendor README).

hello in SHA-256 is 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824. SHA-1 of the same string is aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d. Use the generator to confirm your script’s output, not to invent a third alphabet.

HMAC when you need authenticity

A bare checksum answers “are these the same bytes?” HMAC answers “did someone who knows this secret produce this digest?” Enable HMAC on /tools/hash-generator, paste the shared key, and hash the same message. The secret stays in the tab.

HMAC does not replace TLS, and it does not replace signing with a private key when many parties must verify. It is the right tool for a webhook signature or an internal job payload. It is the wrong tool for a public download page — you cannot put the HMAC key on the page.

Uppercase hex and local files

Some Windows-oriented lists print SHA-256 in uppercase. The bits are the same; only the letters differ. Toggle uppercase on the generator rather than running the file twice. Compare case-insensitively if you are writing a script.

File mode hashes the dropped file’s bytes with Web Crypto. Nothing is uploaded. Very large files are limited by what the browser will read into memory; for multi-gigabyte ISOs, a streaming CLI (sha256sum) is more appropriate. The 5 MB cap you may know from /tools/image-to-base64 is not this tool’s model — here you drop a local file for digesting, not for a data URI.

MD5 is omitted on purpose

MD5 is still on a lot of old mirrors. It is collision-broken: two different files can share an MD5. Do not use it to decide whether software is safe. If a vendor only publishes MD5, look for a signature or a SHA-256 from a second channel.

/tools/hash-generator will not compute MD5. That is deliberate, so the page cannot be used as a “quick MD5 of a password” toy. For passwords, see the password-storage guide — checksums are the wrong primitive.

Common pitfalls

Hashing a text paste of a binary file (copy from a terminal that mangled bytes) produces a digest of the paste, not the artifact. Always drop the file. Comparing SHA-256 of a .zip to a digest computed on the unpacked tree will never match.

Trusting a checksum that travelled in the same HTTP response as the malware is circular. Prefer a checksum on HTTPS from a different path, a signature, or HSTS-backed vendor site. And do not store user passwords as SHA-256 just because this tool made hex look tidy.

  • SHA-256 for new checksums; SHA-1 only for legacy lists.
  • HMAC needs a secret; public checksums do not use HMAC.
  • MD5 is not offered in /tools/hash-generator.

Worked examples

SHA-256 of hello

Input
hello
Output
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824

64 lowercase hex characters. Toggle uppercase on /tools/hash-generator if your manifest uses A–F.

HMAC-SHA-256 (RFC 4231 test case 2)

Input
data: what do ya want for nothing? · key: Jefe
Output
5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843

Enable HMAC on /tools/hash-generator and use the same key. This proves authenticity only while Jefe stays secret.

Frequently asked questions

Does a matching SHA-256 mean the file is safe?

It means it matches the bytes that were hashed. Safety still depends on who published the digest and whether you trust that channel.

Why is there no MD5 option?

MD5 is collision-broken and too often misused for security. /tools/hash-generator omits it on purpose. Use SHA-256.

Can I hash a file without uploading it?

Yes. Drop it on /tools/hash-generator. Web Crypto runs in the browser; the file is not sent to thedevtools.in.

When should I use HMAC instead of a plain hash?

When you and the sender already share a secret and you need to detect a third party changing the message. Public download checksums stay as plain SHA-256.

Summary

Hash the file you received, compare SHA-256 to the publisher’s digest, and use HMAC only when a shared secret exists. /tools/hash-generator runs SHA-1 through SHA-512 locally, with an uppercase hex toggle, and leaves MD5 out of the menu on purpose.

Try it yourself

Put what you've learned into practice with our free browser-native tool.

Open Tool →