Checksum: a value calculated from the data (typically by summing the bytes) and transmitted alongside it. The receiver re-calculates the checksum and compares.
How it works:
- Sender computes checksum (e.g., sum of all bytes mod 256).
- Sender transmits data + checksum.
- Receiver re-computes checksum on received data.
- Receiver compares to received checksum.
- If different → error detected.
Worked example. Data: 110, 45, 200. Checksum (sum mod 256) = 355 mod 256 = 99.
If transmission is clean, receiver sums the same bytes, gets 355 mod 256 = 99, matches the transmitted checksum. ✓
If a byte is corrupted (110 → 113), receiver computes 113+45+200 = 358 mod 256 = 102. 102 ≠ 99 → error detected.
Stronger than parity because it's sensitive to each byte's value, not just bit counts.
Used in: IP packets (header checksum), TCP, file transfers, archive formats.
Limitation. Coincidental cancellation can still occur — extremely rare in practice for any non-trivial checksum.