/ THE IDEA
The sender calculates a value from the original data. The receiver calculates the same function on the received data and compares. A mismatch proves the two inputs differed if the comparison and algorithm ran correctly. A match is weaker. Many inputs can share a checksum, especially a short simple one. A cryptographic hash is designed to make deliberate collision finding difficult, while a message authentication code also uses a secret key to establish an authorised source. Those are different guarantees.
THE FORMAL IDEA
toy checksum = (sum of byte values) mod 256
| A byte stores a value from 0 to 255. | | mod 256 means keep the remainder after division by 256. This intentionally weak example demonstrates change detection; it is not a recommended security mechanism. |
|
RUN THE TINY EXAMPLE
Change one thing. Predict what happens.
Original bytes: 10, 20, 30 → sum 60 → checksum 60. Change last byte to 31 → sum 61 → mismatch detected. Change two bytes instead: 11, 19, 30 → sum still 60. The checksum matches despite changed data.
|
The final case shows the failure directly. Two changes cancel in the sum. A successful verification therefore means passed this particular test, not mathematically identical under every conceivable alteration.
/ SO WHAT?
A trusted published cryptographic hash can make accidental corruption and unauthorised replacement easier to detect. But if an attacker can replace both the file and its displayed reference value, comparing those two attacker-controlled items proves little about origin. Distribution and trust in the expected value matter.
ONE CAVEAT |
| Real transport checks, storage codes and cryptographic functions use stronger designs than this sum. The right mechanism depends on accidental errors versus an adversary and whether origin must be authenticated. |
KEEP THIS
A verification value is useful only when its error-detection strength and the trustworthiness of the expected value match the threat.
|
NEXT: How stretched light tells us about a growing universe
|