Why Two Tools Produce Different SHA-256 Hashes for the Same Text
A developer reports that pasting identical text into a hash tool and running sha256sum yields mismatched digests, though nothing is broken. Hashes are computed over raw bytes, and the same visible text can differ in bytes because of a trailing newline (echo adds one, printf does not), Windows-style line endings, or the character encoding used such as UTF-8, UTF-16 or Latin-1. Unicode also allows accented letters to be stored as a single character or as a letter plus a combining mark, so normalization such as NFC is needed before comparing user-typed text. The article recommends checking a known value like "hello" on both sides to confirm the inputs match byte for byte.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in