SkyShelf

Guides

How to Verify a Download With SHA-256 on Windows

How to Verify a Download With SHA-256 on Windows

A checksum is a short fingerprint of a file. If you compute the SHA-256 value of a download and it matches the value the publisher lists, the file is identical to what they released, byte for byte. That protects against corrupted downloads and, if you got the checksum from a trustworthy place, against tampered files. This guide shows three built-in ways to compute SHA-256 on Windows and how to compare results safely. The commands are based on Microsoft's and 7-Zip's own documentation.

What a checksum can and cannot tell you

  • It can show that a file was not corrupted in transit.
  • It can show that a file matches a published value.
  • It cannot prove the publisher is honest, or that the checksum itself came from a safe place. If an attacker controls the page that offers both the file and the checksum, both can be replaced.

For that reason, take the checksum from the official project site over HTTPS, ideally a different page or channel than the download link.

Method 1: PowerShell

PowerShell includes the Get-FileHash cmdlet. Microsoft's documentation states that it uses SHA256 by default.

  1. Open Windows Terminal or PowerShell from the Start menu.
  2. Move to the folder holding the download, for example cd $HOME\Downloads.
  3. Run:

Get-FileHash .\installer.exe

  1. Read the Hash column in the output.
  2. To request another algorithm explicitly, add the -Algorithm parameter, for example Get-FileHash .\installer.exe -Algorithm SHA256.

Method 2: certutil in Command Prompt

Windows also ships certutil, whose documentation lists a -hashfile option that generates and displays a hash over a file with an optional algorithm.

certutil -hashfile installer.exe SHA256

The output shows the hash on its own line. Ignore the status text before and after it.

Method 3: 7-Zip's command line

7-Zip includes a hash command. Its documentation says the h command calculates hash values for files, supports CRC32, CRC64, SHA1, SHA256 and BLAKE2sp, and defaults to CRC32. That default matters: you must name SHA-256 explicitly.

7z h -scrcsha256 installer.exe

Note that 7z has to be reachable from your PATH; otherwise run it from the 7-Zip installation folder.

Using Git Bash

If you have Git for Windows installed, its Git BASH shell provides a Unix-style command line. Such environments typically include a sha256sum tool, so you can run sha256sum installer.exe. Check that the command exists on your installation before relying on it.

Comparing the result

Do not compare long strings by eye. Instead:

  1. Copy the official checksum into a plain-text file or the terminal.
  2. In PowerShell, compare directly:

(Get-FileHash .\installer.exe).Hash -eq "PASTE_OFFICIAL_HASH_HERE"

PowerShell string comparison with -eq ignores case by default, which suits hexadecimal values written in upper or lower case. The result is True or False.

Typical use: checking an ISO before writing a USB stick

When you download a Linux or Windows ISO to make bootable media with Rufus, verify the ISO first. Writing a corrupt image to a USB drive wastes time and can produce confusing install errors. Rufus is a utility for creating bootable USB drives from ISOs, so checking the image beforehand is the sensible order of operations.

Common problems

Symptom Likely cause Fix
Hash does not match Interrupted or corrupted download Download again, preferably from the official mirror
Hash still does not match Wrong file version or wrong architecture Compare the file name and version with the checksum list
Different-length output Wrong algorithm Use SHA256 explicitly
7z not recognised Not on PATH Run it from its installation folder
Access denied File in use Close the program using the file

FAQ

Is SHA-256 better than MD5? SHA-256 is the more commonly recommended choice for integrity checks today. Use whichever the publisher provides, but prefer SHA-256 when there is a choice.

Does a matching hash mean the file is safe? No. It means the file matches what was published. Whether the publisher's file is trustworthy is a separate question.

Do I need to verify everything? Not every small download, but do it for operating-system images, security software and anything you will run with elevated rights.

Where do I find the official checksum? On the publisher's download page, release notes or a signed checksum file, depending on the project.

Summary

Pick one method, learn its command, and keep it handy. Get-FileHash is the shortest route on a stock Windows installation. Make verification a habit for installers and images, and always take the expected value from a source you trust.

Comments

No comments yet.

Code