You downloaded a large installer over shaky hotel Wi-Fi, and something feels off. A string of 64 characters next to the download link settles the question in seconds.
The short answer
A checksum, or hash value, is a fingerprint of fixed length computed from data: a hash algorithm maps a message of any length to a fixed-length message digest [2]. SHA-256 belongs to the SHA-2 family that NIST standardizes in FIPS 180-4; its value is 256 bits long and usually written as 64 hexadecimal characters [1][2]. How do you verify a download? Compute the SHA-256 value of your file and compare it with the published one: if they match, the file has not changed since that value was computed [1]. Our assessment: a matching checksum proves integrity, not origin – for that you need a signature.
How it works
- Same data, same value. A hash function always produces the same digest for the same data, and FIPS 180-4 says digests are used to detect whether messages have changed since the digests were generated [1]. Change the data, and the value changes too; that is what makes the comparison useful.
- Strong and weak algorithms. FIPS 180-4 specifies SHA-1 and the SHA-2 algorithms SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256 [2]. NIST deprecated SHA-1 in 2011 and disallowed it for digital signatures at the end of 2013 [2]. Microsoft says MD5 and SHA-1 are no longer considered secure and should only be used for simple change validation, not for files that need protection from attack or tampering [3].
- Windows. The PowerShell cmdlet
Get-FileHashcomputes the hash of a file and uses SHA256 by default; it also accepts SHA1, SHA384, SHA512 and MD5 [3]. - Linux and macOS. On Linux,
sha256sumcomputes the value, and with-cit reads checksums from a file and checks them [4]. On macOS,shasumcomputes SHA-1 unless you pass-a 256, and its behaviour mimics the GNU tools such assha256sum[5]. - The limit. If the checksum sits on the same web page as the file, it mainly catches broken downloads: whoever can replace the file can usually replace the number as well. That is why Ubuntu publishes a GPG signature for its checksum file. The signature shows that the checksum list is authentic, and the checksum shows that the image is intact [6].
A practical example
You download an installer, and the project page lists its SHA-256 value. In PowerShell you compute the value of your copy:
Get-FileHash .\installer.exeThe output shows the algorithm SHA256 and the hash [3]. Comparing 64 characters by eye is error-prone, so let PowerShell compare: (Get-FileHash .\installer.exe).Hash -eq "<published value>" returns True or False, just like Microsoft's own example [3]. On Linux, sha256sum -c SHA256SUMS checks every file listed in a checksum file [4]; on macOS, shasum -a 256 installer.dmg prints the value [5]. If the values differ, delete the file and download it again from a known good source [6].
Checklist
- Take the checksum from the official project page or a signed checksum file, not from a mirror or a forum post [6].
- Use SHA-256 or stronger; don't rely on MD5 or SHA-1 for files that need protection [3].
- Let the tool compare the values instead of reading 64 characters yourself [3][4].
- Verify the signature of the checksum file when the project offers one [6].
- Download the file again from a known good source if the values differ [6].