Payments are experiencing issues due to temporary restrictions in Russia. If your payment does not go through, please submit a support request.Our support team is available 24/7 — we are always here to help with hosting and server issues.We are now accepting requests for dedicated server rental and colocation services in our data center.Reminder: we recommend enabling backups for additional data protection.A new VPS/VDS lineup with NVMe storage and improved performance is now available.Maintenance work on some servers has been completed. All services are operating normally.
Article3 min readViews0

How to Verify File Integrity Using SHA-256

We compare the checksum of a downloaded archive against a trusted value and explain what this verification proves and what it does not confirm.

Two identical external drives for comparing file copies
In this article

The archive downloaded without visible errors, but that is not enough to confidently use it for recovery or updates. A checksum helps verify whether the bytes match the expected file. Crucially, the source of the expected value matters: an untrusted archive paired with an untrusted checksum does not become reliable.

Calculate the checksum of the completed file

The example is calculated for GNU Coreutils on Linux. The file archive.tar.gz is a placeholder name: substitute your path and wait for the download to complete fully.

sha256sum -- archive.tar.gz

The command reads the entire file and outputs the hash along with the filename. For a large archive, this creates disk load. Do not calculate the checksum of a file that is still being modified; the result will not be a stable characteristic of the final version.

Compare the entire value, not just the first and last few characters. If a trusted checksum file in a supported format is available, it is more convenient to delegate the verification to a utility:

sha256sum --check SHA256SUMS

Verify the origin of the expected checksum

The file SHA256SUMS in the example must be obtained from a trusted source. A match with the checksum sent by the same unknown sender along with the archive confirms the consistency of the pair, but not the authenticity of the provider.

If a developer publishes a signed list of checksums, verifying the signature is a separate task requiring a trusted key. Do not substitute it with a simple SHA-256 comparison. Similarly, a matching hash does not guarantee the absence of malicious code in the source file.

Analyze a failed verification

A mismatch may indicate corruption during transfer, a different release, a modified file, or an incorrectly selected expected checksum. First, compare the name, version, and size. Do not attempt to "fix" the checksum list to match the downloaded archive just to achieve a successful result.

A message stating that a file cannot be opened differs from a content mismatch. Check the working directory and paths within the list. When automating, account for the exit code and do not hide messages explaining the reason for failure.

Example with a backup

If an archive is copied to another storage medium, comparing the hash before and after transfer helps verify byte-for-byte matching. However, this is insufficient for operational backups: the archive may be intact yet lack the required database or correspond to the wrong point in time.

Therefore, store details alongside the archive about exactly what was archived and when. Verifying restoration in a separate environment answers a different question—whether a functional system can be recovered. A hash does not replace this verification.

What constitutes a completed verification

Record the file name and version, the source of the expected checksum, the algorithm, and the comparison result. If the file is later modified or rebuilt, the previous check no longer applies. Before using it, ensure this is the same verified object.

If there is a mismatch, stop using the specific file and investigate the source. Success is needed not for a green label, but for a clear chain: the expected release, a trusted checksum, a fully received file, and an exact match of its contents.

Discussion 0

Share your experience and ask questions. Comments without links appear after editorial review.

No comments yet. Start the discussion.