Security tools · Lesson 14 of 14

Hashes & file integrity

What hashes are, how SHA-256 works as a file fingerprint, and how to verify downloads on Windows, macOS and Linux. Try it in a live hash lab.

⏱ 14 min🎯 Beginner🧪 Hands-on practice🎬 Video

By the end, you’ll be able to…

  • Explain the properties of a cryptographic hash
  • Verify a downloaded file’s SHA-256 checksum on your own computer
  • Know why MD5 and SHA-1 are retired for security, and how to look up a hash safely

Key words

Hash function
Turns any data into a fixed-length fingerprint. The same input always gives the same output.
SHA-256
A widely used hash function that produces a 256-bit (64 hex character) fingerprint.
Checksum
A hash published next to a download so you can check your copy is identical.
Collision
Two different inputs with the same hash. Good hash functions make this practically impossible.
Avalanche effect
A tiny change to the input completely changes the hash.

A fingerprint for data

A hash function takes any input, whether a word, a photo or a 5 GB ISO, and produces a fixed-length fingerprint. For SHA-256, that’s 64 hexadecimal characters:

$ echo -n "tux" | sha256sum
(try it in the hash lab below to see the real value)

Good cryptographic hashes have four properties:

  1. Deterministic: same input, same hash, every time, on every computer.
  2. One-way: you can’t turn the hash back into the input.
  3. Avalanche: change one letter and the hash changes completely.
  4. Collision-resistant: it’s practically impossible to find two inputs with the same hash.

Where hashes show up

  • Verifying downloads: make sure an ISO or installer wasn’t corrupted or tampered with.
  • Password storage: sites store salted, slow hashes, not passwords (see the passwords lesson).
  • Forensics: investigators hash evidence to prove it hasn’t changed since it was collected.
  • Threat intelligence: known malware files are shared and searched by their hashes.
  • Git: every commit is identified by a hash.

Verify a download, step by step

Download sites like Ubuntu publish a list of SHA-256 checksums. After downloading, compute your own and compare.

# Linux
sha256sum ubuntu-desktop.iso
# or check automatically against the published list:
sha256sum -c SHA256SUMS --ignore-missing

# macOS
shasum -a 256 ubuntu-desktop.iso

# Windows (PowerShell)
Get-FileHash .\ubuntu-desktop.iso -Algorithm SHA256

If every character matches, your file is identical to the one the publisher hashed. If even one character differs, delete it and download again.

Extra credit: a checksum only helps if the checksum list itself is genuine. Projects like Ubuntu also sign their checksum list with GPG, so you can verify it came from them. Ubuntu’s official tutorial walks you through both steps.

MD5 and SHA-1: retired for security

Researchers have shown practical ways to create collisions for MD5 and SHA-1, so they shouldn’t be trusted where an attacker could be involved. You’ll still see them used to catch accidental corruption. For anything security-related, use SHA-256 or stronger.

Looking up a suspicious file

VirusTotal checks files against many antivirus engines. The privacy-friendly habit is to search by hash first: if someone already submitted the same file, you get results without uploading anything. Be careful uploading: files submitted there can be shared with security researchers, so never upload private documents like school work, IDs or anything with personal data.

🧪 Hands-on

Practice

Type anything and watch its SHA-256 hash update live. Then change a single character. This uses your browser’s built-in crypto, so nothing leaves your device.

🎬 Watch

Video: Hashing Algorithms and Security

HashesHashing Algorithms and SecurityComputerphile · Watch on YouTube

Video by Computerphile, hosted on YouTube. It loads only when you press play.

✅ Check yourself

Quick quiz

Q1. You change one letter in a 10-page document. What happens to its SHA-256 hash?
Q2. Can you recover the original text from a SHA-256 hash?
Q3. Which is the safest first step with a suspicious file on VirusTotal?