How to Know a Received File Is Complete and Uncorrupted

By ShareDrop.org Engineering · Published · Updated

“Transfer complete” and “the file is intact” are different claims. A tool can finish sending bytes and still deliver a corrupted file, because of a bug, an aborted retry, a disk error, or the source file changing mid-read. The only trustworthy completion signal is a checksum computed independently on both ends.

How ShareDrop.org verifies every file

  1. The sender hashes each 64 KiB chunk into a running SHA-256 as it reads and sends it.
  2. The receiver hashes the same chunks as it writes them to their destination.
  3. After the last chunk, the sender transmits its final digest.
  4. The receiver compares digests. Equal → the file is marked done. Different → the file is marked failed, the partial data is discarded (not left behind as a plausible-looking file), and the sender is told.

The ShareDrop.org engine test suite includes a deliberate corruption test (one flipped byte in a 100 KB transfer) and asserts that both sides report failure and the receiver discards the data. A verification system you have never seen fail is a verification system you should not trust.

Why hash during, not after

Hashing a received file “at the end” would require reading it back — slow for multi-gigabyte files and impossible in browsers that only had a streaming path to disk. Incremental hashing costs almost nothing per chunk, keeps memory flat, and also detects a subtle failure: a source file that changes while being sent produces a digest matching neither the old nor the new version, and the mismatch surfaces immediately.

Verifying a file yourself, on any platform

If you ever want to double-check a file against a hash someone gave you:

# macOS / Linux
shasum -a 256 yourfile.zip

# Windows PowerShell
Get-FileHash yourfile.zip -Algorithm SHA256

Identical output = identical file, byte for byte. SHA-256 collisions are not a practical concern; for transfer integrity it is effectively a unique fingerprint of the content.

The four ways a file goes wrong

FailureHow it happensWhat you would see without a check
TruncationThe connection drops after most of the file has arrived; the tool saves what it hasA video that stops at 87%, a ZIP that “is corrupt”, a PDF that opens with missing pages
Bit flipsFailing storage, a bad cable, faulty memory on either deviceA photo with a coloured band, a document with one strange character, an installer that fails to verify
Partial writeThe receiving disk fills up mid-file; the operating system reports success for what fitA file of the right name and the wrong size; often noticed weeks later
MisassemblyChunks written out of order or into the wrong file after a reconnectA file of the right size that is subtly wrong throughout

A hash comparison catches all four, because all four change the bytes. That is the whole argument for hashing at the end of every file rather than trusting the transport: the transport guarantees each packet arrived intact, and says nothing about whether the file on disk is what the sender had.

Checksums are not signatures

A matching hash proves the bytes are identical to the sender's. It does not prove who the sender is: an impostor who intercepted the introduction could send you their file with their correct hash and it would verify perfectly. Integrity and authenticity are separate questions with separate answers: the hash for the first, the safety code for the second. A transfer with both is one where the file is intact and came from the device you think it did. A digital signature would answer both at once, but needs a long-term key for the sender, which an account-free tool does not have.

Why SHA-256, and not CRC32, MD5 or SHA-1

AlgorithmCatches accidental corruptionResists deliberate forgeryWhere it is still fine
CRC32Yes, for small random errorsNo: trivial to forgeInside ZIP files and network frames, against line noise
MD5YesNo: collisions are cheap since 2004Detecting accidental changes to files nobody is attacking
SHA-1YesNo: practical collisions since 2017Legacy systems; avoid for anything new
SHA-256YesYes, with no known practical attackEverything, including this

For a transfer tool the difference matters in one scenario: an attacker who can alter the file in transit and also alter the hash you compare against. With SHA-256 they cannot craft a different file with the same hash, so a hash obtained through a channel they do not control is a real check. With MD5 or CRC they could.

How fast hashing is

Modern CPUs have dedicated SHA-256 instructions, and even without them the algorithm runs at hundreds of megabytes per second in a browser through the Web Crypto API and well over a gigabyte per second natively. A file transfer over any real network is far slower than that, which is why hashing every chunk as it passes costs nothing you can measure: in ShareDrop.org's same-machine benchmark the full pipeline sustains 200+ Mbps with SHA-256 running on both ends, and the hash is never the limiting step. The only way verification becomes visible is if a tool waits until the end and reads the whole file again from disk: a design choice, not a property of hashing (what that looks like).

Comparing hashes by hand without making mistakes

Frequently asked

Does verification make the transfer slower?

Not measurably, if it is done incrementally. If a tool pauses at the end to hash, that pause is the cost of not having hashed along the way.

The hashes differ. Now what?

Retry the transfer. A second mismatch on the same file points at the storage on one side (run a disk check), or at a file that is still being written by another program on the sender. A mismatch that appears only over one network and not another is worth reporting; it should not happen with an encrypted transport and would indicate a bug.

My ZIP has its own checksum: is that enough?

ZIP stores a CRC32 per file, which catches accidental corruption of the archive's contents when you extract. It does not verify that the archive you received is the one that was sent, and it is easily forged. Treat it as a second net, not the first.

For recurring transfers: automate it

If the same folders move between the same machines regularly, stop comparing by hand. On the source, generate a manifest once, find . -type f -exec sha256sum + > manifest.sha256, send it along with the files, and on the destination run sha256sum -c manifest.sha256, which prints one line per file and a clear FAILED for any that differ. rsync --checksum does the equivalent inline for machines you can reach over SSH, comparing content rather than timestamps. A tool that verifies each file as it lands, as ShareDrop.org does, makes this a second check rather than the first, but for archives that will be read years later, a manifest stored beside the files is the only check that still works when the transfer tool is long gone.

What integrity checking does not cover

How this is tested

Standards referenced