Ada Audits the Check-Value Arithmetic

Ada re-derives this chapter’s own numbers step by step, at full precision

foundations
math-foundations
calculation-audit
fundamentals
beginner
Ada ADA · CALCULATION AUDIT

Ada Audits the Check-Value Arithmetic

The chapter’s worked example runs an 8-bit addition checksum over the bytes AA 03 10 00 EB and keeps the low byte, 0xA8. Then it swaps the 03 and 10 bytes and the checksum still reads 0xA8, so the corrupted order slips through — the blind spot that motivates a CRC. This audit recomputes the sum, reproduces that byte-swap failure, and compares check-value widths to ask what the arithmetic actually buys the receiver.

Companion to the chapter Packet Error Detection — every number here comes from that chapter.

A check value is a small mathematical shadow of the protected bytes. The useful question is not whether the shadow exists, but which byte changes can keep the same shadow and what risk the receiver still carries.

1. Recompute the chapter's checksum example. The protected bytes are AA 03 10 00 EB, and the chapter uses an 8-bit addition checksum with the low byte kept.

0xAA + 0x03 + 0x10 + 0x00 + 0xEB = 170 + 3 + 16 + 0 + 235 = 424 = 0x1A8
low byte = 424 mod 256 = 168 = 0xA8

2. Prove the swap blind spot. Swapping 03 and 10 changes the order but not the addition result:

0xAA + 0x10 + 0x03 + 0x00 + 0xEB = 170 + 16 + 3 + 0 + 235 = 424 = 0x1A8
low byte after the swap = 424 mod 256 = 0xA8, so this checksum still passes

3. Compare check-width scale without overclaiming. Width alone is not a CRC specification, but it does set the size of the check-value space. Under a simple uniform random collision model:

Check width Arithmetic Scale
8-bit checksum 1 / 2^8 = 1 / 256 0.390625%
CRC-16 width 1 / 2^16 = 1 / 65,536 0.001526%
CRC-32 width 1 / 2^32 = 1 / 4,294,967,296 0.0000000233%

What the mathematics buys you: the receiver can now explain both the acceptance decision and the residual risk. The checksum example is reproducible, the byte-swap failure is visible, and the CRC discussion stays honest: a wider check space helps accidental-error screening but still does not authenticate the packet.

Every number above is taken from the chapter’s own material and re-derived step by step.