My Day✳All blog articles ↗

Compare a file with its full SHA-256 digest

Compare full digests, even when byte counts match.

A digest can reveal byte changes against a saved reference. Compare the full value and exact content, including the line ending. Equal size does not prove a match; the digest alone does not establish authorship or correctness.

Source: 6 bytes; different copy: 6 bytes
Source: 6 bytes; different copy: 6 bytes

What to do

  1. Identify the required source version and the origin of its full SHA-256.
  2. Calculate the candidate bytes’ full digest with the same algorithm, preserving the source.
  3. Compare every character; leave obtaining the correct version open if they differ.

Example

Fictionally, the source is North followed by one LF byte; the copy is north with the same LF, UTF-8 without BOM. Both have 6 bytes. Full SHA-256: North+LF — 1f01546aa7bb27002303ee464de83039d150391a5bf83375336f23cc09c261d4; north+LF — 0de53ab3c043ea1f5a860e05a12b4319c6900d6df81c11c9894ed4103ab512b9. They differ. The copy is not confirmed; obtain the required version and rehash it fully. No real file transfer occurred.

My Day · Windows

Save this note manually in My Day.

Buy My Day for Windows ↗