How-to
Check whether a document matches a trusted copy
You receive a revised contract or download a document whose sender has supplied a checksum. A SHA-256 comparison can check whether your file matches that reference at the byte level. The reference must come from a source you trust: an attacker who can replace both the file and its checksum can make them agree. This guide uses a plain checksum, without a signing certificate or secret key.
Check whether a document matches a trusted copy
Step by step
- Finish the source document before creating its reference hash. Open Hash Generator, choose SHA-256 and leave HMAC disabled. Use the file picker to select the actual saved file. Hashing text copied from a PDF would only hash that copied text, not the PDF's bytes or structure.

- Wait for the result and copy all 64 hexadecimal characters into a local record alongside the algorithm, filename and version. Keep the original file unchanged. Share the reference through an authenticated source or a separately trusted channel so the recipient has a reason to trust it independently of the downloaded attachment.
- On the recipient's device, select SHA-256 with HMAC off and choose the received file. Paste the trusted reference checksum into the built-in verification input to check for an automatic match or mismatch badge (the field auto-detects common hash algorithms, though you should still confirm the right file and algorithm). If they differ, check the algorithm and file version, then request the intended file through the trusted channel.

Test a copy and a changed document
The demonstration starts with a small text document that contains an amount of 500. A byte-for-byte copy produces the same SHA-256, even if its filename changes. Editing the amount to 900 and saving produces a different hash. Other changes can be less visible: a PDF editor can rewrite metadata or internal structures without changing the page's appearance, and a text editor can change line endings or encoding. A different hash identifies different bytes; it does not tell you which field changed or whether the change was intentional. Compare document contents separately when you need that explanation.
| Feature | SHA-256 (NIST FIPS 180-4) | SHA-512 (64-bit Architecture) | MD5 / SHA-1 (Deprecated) |
|---|---|---|---|
| Reference | 256 bits (64 Hexadecimal Chars) | 512 bits (128 Hexadecimal Chars) | 128 / 160 bits (Collision Risk) |
| Scope | Cryptographically Secure (Zero Collision) | Cryptographically Secure (Post-Quantum Resilient) | Broken (SHAttered / Flame Attacks) |
| Processing mode | crypto.subtle.digest("SHA-256") | crypto.subtle.digest("SHA-512") | Web Crypto SubtleCrypto + Pure JS MD5 |
The reference is part of the check
A checksum included next to a download helps detect accidental corruption, but its security value depends on where the checksum came from. If the same compromised page supplies both a substituted file and its new hash, the comparison will succeed. Use a reference published by the source you intended to trust or confirm it through an already trusted contact route. Do not compare just the first or last few characters. Also distinguish a plain SHA-256 from HMAC-SHA-256, which uses a shared secret and is a different operation even though its output has the same length.
| Feature | macOS / Linux CLI | Windows PowerShell CLI | Hash Drift (CRLF / Save Metadata) |
|---|---|---|---|
| Reference | shasum -a 256 document.pdf | Get-FileHash document.pdf -Algorithm SHA256 | CRLF vs LF Conversion or PDF /Info Re-save |
| Best for | <64-hex> document.pdf | Algorithm: SHA256 | Hash: <64-hex> | Different Bytes = Completely Different Hash |
Matching hashes do not identify an author
For an ordinary integrity check, matching full SHA-256 values provide strong evidence that the files contain the same bytes. That does not establish who created the document, when it existed, whether its statements are true or whether it satisfies an evidentiary procedure. The browser tool reads the selected file into local memory and uses Web Crypto for SHA-256 without uploading the file. It does not issue a trusted timestamp, preserve a chain of custody or attach a digital signature. Keep the original reference and use the procedure required by the recipient when you need those separate assurances.
The tools used in this guide
Frequently asked questions
Why did the hash change when the pages look identical?
The hash covers every file byte, including metadata and document structures that may not be visible on a page. Re-saving, adding a signature image, changing line endings or exporting through another program can change those bytes. Compare the exact delivered files and generate the reference only after finishing the version you intend to share.
Should I choose MD5 or SHA-1 for a new integrity workflow?
Use SHA-256 for this workflow. The tool retains MD5 and SHA-1 for legacy compatibility and displays a warning about their collision weaknesses. If a sender supplies an older checksum, reproducing that algorithm can check agreement with the supplied value, but do not treat it as the same security assurance as a trusted SHA-256 reference.