Practical Security Last reviewed: October 2026 • 7 min read

How to Verify File Integrity with SHA-256 Checksums

Verifying a file's integrity means hashing the downloaded file locally with SHA-256 and comparing the resulting 64-character hexadecimal digest against the publisher's official published checksum. If even a single bit was tampered with by malware or corrupted by network packet loss, the hashes will fail to match, warning you before you execute the software.

💡
In short

Never run critical downloaded binaries without verification. Publishers post official SHA-256 checksums alongside their software. Running a quick terminal command (shasum -a 256 filename on macOS/Linux or Get-FileHash on Windows) proves whether the binary in your downloads folder is byte-for-byte identical to the original release.

01. The Plain-Language Analogy: The Holographic Tamper Seal

Imagine receiving a high-security shipping crate containing critical aircraft parts. Rather than dismantling all 5,000 internal precision gears to ensure no one tampered with the crate in transit, the factory placed a serialized, holographic tamper-evident tape across all box seams.

The factory publishes that exact serial code on their corporate security board. When the crate arrives at your hangar, you verify that the holographic tape is intact and matches the serial number. If an eavesdropper cut the tape or substituted a counterfeit part, the seal fractures visibly. A SHA-256 checksum is an unforgeable digital holographic seal: altering even one byte out of ten billion bits irreversibly fractures the hash into an entirely different 64-character string.

02. Step-by-Step Mechanics: Verifying in the Terminal

macOS & Linux
Using shasum or sha256sum

Run the built-in SHA-256 command against your downloaded file:

shasum -a 256 ubuntu-24.04-desktop-amd64.iso
Windows
Using PowerShell Get-FileHash

In PowerShell, execute the native cryptographic utility:

Get-FileHash .\ubuntu-24.04-desktop-amd64.iso -Algorithm SHA256
Automated
Automated Batch Verification via SHA256SUMS

When downloading a manifest file with multiple files, verify automatically:

sha256sum -c SHA256SUMS --ignore-missing

Returns OK for matching files, or FAILED if any bit differs.

Node.js Streaming Verification (Memory Efficient):
import crypto from 'node:crypto';
import fs from 'node:fs';

// Stream-based SHA-256 verification (memory-efficient for multi-gigabyte ISO files)
function verifyFileSHA256(filePath: string, expectedHash: string): Promise<boolean> {
  return new Promise((resolve, reject) => {
    const hash = crypto.createHash('sha256');
    const stream = fs.createReadStream(filePath);

    stream.on('data', chunk => hash.update(chunk));
    stream.on('error', err => reject(err));
    stream.on('end', () => {
      const calculatedHash = hash.digest('hex');
      console.log('Calculated SHA-256:', calculatedHash);
      console.log('Expected SHA-256:  ', expectedHash);
      resolve(calculatedHash.toLowerCase() === expectedHash.toLowerCase());
    });
  });
}

03. Worked Example: Ubuntu 24.04 LTS Desktop ISO (Live Data)

This is the authentic published release hash from Canonical for the official Ubuntu 24.04 Noble Numbat LTS desktop installation media:

Official ISO Image ubuntu-24.04-desktop-amd64.iso
File Size 6,094,364,672 bytes (~5.67 GB)
Official SHA-256 Checksum 81fae9cc21e2b1b3a80de60cb62d8845b48c58908f5d5b5624c57c4f0273e181
Canonical PGP Signing Key ID 0x46181433FBB75451 (Ubuntu CD Image Signing)
Integrity Status Verified Exact Match ✓

If an attacker intercepted your download and inserted a keylogger into the kernel, the resulting hash would change entirely. Checking this hash takes 4 seconds and protects your entire machine.

04. Common Misconceptions Corrected

✕ Misconception: "Downloading over HTTPS means file checksum verification is redundant."

Reality: HTTPS only guarantees that the file was encrypted between your computer and the download server. If the server itself, a regional download mirror, or a third-party CDN is breached (as occurred during the Linux Mint incident in 2016), HTTPS cheerfully delivers a backdoored ISO with a valid green padlock.

✕ Misconception: "Checking the first 4 and last 4 characters of a hash is sufficient."

Reality: Skimming only the beginning or end of a hash leaves you vulnerable to chosen-prefix attacks or lazy visual spoofing. Always compare the full 64 characters or let the shell compare them automatically (echo "$EXPECTED $FILE" | sha256sum -c).

✕ Misconception: "MD5 and CRC32 are just as good as SHA-256 for file security."

Reality: CRC32 is not a cryptographic hash; it is an error-detecting code designed solely for accidental line noise. MD5 was mathematically broken for collisions in 2004. Attackers can easily craft a malicious executable that produces the identical MD5 or CRC32 checksum as a clean binary. Only SHA-256 or SHA-512 are cryptographically secure against intentional modification.

05. Defense-in-Depth: Combining PGP Signatures with SHA-256

What if an attacker hacks the main website and changes both the download link and the published SHA-256 hash? Defense-in-depth requires signed checksum files:

Step A: Authenticate the Checksum List gpg --verify SHA256SUMS.gpg SHA256SUMS

Proves cryptographically that the list of checksums was created by the publisher's offline master PGP key.

Step B: Validate the File Against the List sha256sum -c SHA256SUMS

Proves that the multi-gigabyte ISO you downloaded matches the signed checksum byte-for-byte.

06. Primary Sources & Official References