What is a file hash — and why would you need one?
A file hash (sometimes called a checksum or digest) is a short, fixed-length fingerprint that uniquely represents the contents of a file. Two files are byte-identical if and only if they produce the same hash. Change a single byte and the hash changes completely.
1
Verify a download is authentic
Software publishers post the SHA-256 of their installer next to the download link. Run the same algorithm on your downloaded file — if the hashes match, the file wasn't corrupted in transit and wasn't replaced by an attacker.
2
Detect duplicate files
Comparing every byte of every pair of files would take forever. Comparing hashes is instant. Backup tools, deduplication scripts and forensic software all rely on hash matching to find duplicates without re-reading files.
3
Confirm file integrity
Hash a file before sending it, hash it after receipt — if the hashes match, the file is intact. Used in legal evidence handling, chain of custody, and large file transfers over unreliable networks.
4
Index large file libraries
Content-addressed storage (Git, IPFS, BitTorrent) uses hashes as identifiers — every commit, every blob, every chunk has a unique hash. Useful for power users who want stable IDs for files that survive renaming.