Skip to content
Bytearium

No ads or affiliate links active

IT fundamentals

Checksum and hash (SHA-256)

Checksum and hash (SHA-256): how to verify a download on Windows, macOS and Linux, and why a matching value proves integrity, not who made the file.

This entry is still below our minimum bar for the search index (length and number of sources) and is being reworked. It is therefore not listed in search engines.

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

  1. 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.
  2. 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].
  3. Windows. The PowerShell cmdlet Get-FileHash computes the hash of a file and uses SHA256 by default; it also accepts SHA1, SHA384, SHA512 and MD5 [3].
  4. Linux and macOS. On Linux, sha256sum computes the value, and with -c it reads checksums from a file and checks them [4]. On macOS, shasum computes SHA-1 unless you pass -a 256, and its behaviour mimics the GNU tools such as sha256sum [5].
  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.exe

The 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].

Primary sources

These sources are the basis of this page. That does not mean every claim was checked individually; whether a review record exists is shown above under “Status”. The interpretation and checklist are our own work.

There is no documented review record for this version yet. The text relies on the sources listed.

How this page was made: Bytearium creates these pages with the help of AI and is responsible for publishing them. AI can be wrong, so we show our sources and review status openly.

  1. NISTFIPS 180-4, Secure Hash Standard (SHS)
  2. NIST CSRCHash Functions
  3. MicrosoftGet-FileHash
  4. Linux man-pages projectsha256sum(1)
  5. Digest-SHA (MetaCPAN)shasum
  6. UbuntuHow to verify your Ubuntu download

This page has no ads and no affiliate links.