Text checksums: what a matching SHA digest actually proves
When transferring settings or text between systems, you may want to check that the content did not change. A digest makes that comparison compact, but only if both sides cover the same data and the reference is trustworthy.
The algorithm belongs to the comparison
A hash function produces a fixed-length digest from data. Use the same algorithm on both sides; a SHA-256 result cannot be compared directly with a SHA-512 result.
SHA-256 is commonly displayed as 64 hexadecimal digits. More input does not make this digest longer, and the digest is not a compressed copy from which you can recover the original.
References: MDN — SubtleCrypto.digest and fixed-length cryptographic digests
Similar-looking content can contain different bytes
A trailing space, newline or encoding difference can change the digest while leaving the text visually similar. Do not clean the input first if your aim is to inspect exactly what was transferred.
ToolRoof hashes the entered text as UTF-8 without trimming or Unicode normalization. This interface hashes text: pasting a filename does not hash that file’s contents.
The reference needs a trustworthy source
Matching a trusted reference is useful practical evidence of integrity for the compared content. It does not alone establish the author’s identity or prove the content harmless.
An attacker who can replace both content and reference digest may leave them matching. Establish where the reference came from, and do not treat a plain SHA digest as a digital signature or a suitable password-storage system.
References: MDN — SubtleCrypto.digest and fixed-length cryptographic digests
Example: the final newline belongs to the input
Roof without a final newline occupies 4 UTF-8 bytes; its SHA-256 digest starts with c2f6a4d9. Adding a single LF newline produces 5 bytes and a digest starting with 1e5a7f27. The visible text is similar, but the data differs.
These short prefixes are explanatory only; an actual comparison uses the complete digest. When a comparison fails, inspect newlines, spaces and the selected algorithm before concluding that someone tampered with the content.