What is a checksum, and why do downloads have hashes?
A checksum or hash is a fixed-length string calculated from a file's contents. Recalculating it after downloading and comparing against a published value confirms the file is exactly what was intended.
How hash functions work. A cryptographic hash takes input of any size and produces a fixed-length output — 256 bits for SHA-256. The properties that make it useful:
Deterministic — the same input always gives the same output.
Avalanche effect — changing a single bit of input changes roughly half the output bits. There is no partial match; the hash is either identical or completely different.
One-way — you cannot derive the file from the hash.
Collision resistant — finding two different files with the same hash should be infeasible.
What checking a hash detects:
Corruption during download — a truncated file, a network error, a failing disk.
Tampering. This is the security purpose. If a download mirror is compromised and a modified installer substituted, the hash will not match. Software distributed through many mirrors relies on this, and Linux distributions publish hashes for exactly this reason.
How to check. Every major platform has a built-in command — shasum -a 256 on macOS and Linux, Get-FileHash in PowerShell — producing a string to compare against the published one.
The important limitation. A hash published on the same page as the download protects against corruption but not against a determined attacker, who could alter both. That is why serious projects publish signed hashes — a GPG signature proving the hash came from the project's key, which the attacker does not have. Checking a signature is stronger than checking a hash.
Which algorithms. MD5 and SHA-1 are cryptographically broken — deliberate collisions have been demonstrated — so they remain adequate for detecting accidental corruption and should not be relied on against tampering. SHA-256 is the current standard.
Hashes are also used for password storage, deduplication, blockchain and version control.