What you need
The downloaded file, the checksum the publisher lists for it, and a browser or terminal. To check a short piece of text rather than a file, use the Hash Generator instead. If the publisher offers several algorithms, SHA-256 or SHA-512 is the one to use.
Reading the result
A checksum changes completely when a single byte changes. Take a 14-byte file release-notes.txt containing Hello, world! followed by a newline:
| Algorithm | Checksum of release-notes.txt |
|---|---|
| CRC-32 | 7b55a718 |
| MD5 | 746308829575e17c3331bbcb00c0898b |
| SHA-1 | 09fac8dbfd27bd9b4d23a00eb648aa751789536d |
| SHA-256 | d9014c4624844aa5bac314773d6b689ad467fa4e1d1a50a1b8a99d5a95f72ff5 |
Change the exclamation mark to a question mark and the SHA-256 becomes 84c8826b6695ba4f02c9b9a31bb13e2f3fe83c4288cee2f09277e54f5b06ba8d. Nothing about the two values looks similar, which is the point: you never need to compare "how close" two checksums are. They match exactly or the file is different.
On the command line, the same check against a SHA256SUMS file looks like this:
$ sha256sum -c SHA256SUMS
release-notes.txt: OK
and after the one-character change:
release-notes.txt: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
In the calculator, pasting an MD5 value while only SHA-256 is ticked gives No match with a hint that the expected value looks like MD5. Tick that algorithm and the comparison runs again.
Common pitfalls
- Comparing different algorithms. A SHA-1 value will never match a SHA-256 result. Count the characters if the page does not say.
- Hashing text instead of the file. Typing
Hello, world!into a text hasher gives315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3, because the file also contains a newline. Text and files are hashed byte for byte. - Checking a modified copy. Transfers that convert line endings, and tools that unpack or recompress archives, change the bytes. Hash the file exactly as downloaded.
- Getting the checksum from the same place as the file. If a mirror was compromised, its checksum may be too. Prefer the project's own HTTPS site, and a signed checksum file when available.
- Worrying about letter case. PowerShell prints upper-case hex and
sha256sumlower-case. They are the same value, and the calculator ignores case.
Going further
Why a tiny change scrambles the whole value, and why MD5 and SHA-1 are no longer trusted against attackers, is explained in How Hashing Works.