← Tolerance · exhibit 02 of 06
02

Scratch the Code

Reed–Solomon over GF(256) · Reed & Solomon, 1960 · QR, Denso Wave, 1994

This is a real QR code, built from scratch on this page: version 3 at error-correction level H. Its 70 bytes are 26 bytes of message plus 44 bytes of Reed–Solomon parity, split into two interleaved blocks. Each block can locate and repair any 11 corrupted bytes without knowing in advance which ones they are.

Draw on it. Paint over modules, splat it, or slap a sticker on it. The decoder under the panel reads the damaged grid the same way a scanner would, finds the errors, and fixes them. You can also point your phone's camera at the screen and check that it still scans.

decoded
—
block A errors
0/ 11
block B errors
0/ 11
modules flipped
0
The three big squares, the timing stripes, and the small alignment square are locked. They aren't data. They're how a camera finds the grid in the first place.

Try this

  1. Put a big sticker in the middle. That's how "logo in the middle" QR codes work: the logo is just damage the error correction absorbs.
  2. Hit clean, then sprinkle 30 flips a few times. Thirty scattered flipped modules can kill a code that shrugged off a sticker covering a hundred. Turn on the byte map to see why.
  3. Scribble a long line with the scribble brush while the map is on. Each byte is a small 2-wide snake of 8 modules, so a scratch across the grid only damages the bytes it passes through.

The deep cut

Reed–Solomon works on bytes, not bits. A byte with one flipped bit costs exactly as much to repair as a byte with all eight flipped. That's why it loves burst damage like scratches, stickers, and coffee rings, and why it's the outer code on CDs, DVDs, and the Voyager probes. Scattered single-bit noise is the case it handles worst, so CDs interleave their data twice to turn one scratch into many small bursts spread across different blocks.

The trick underneath is that a message becomes a polynomial, the parity bytes force that polynomial to have 22 known roots, and damage shows up as the polynomial no longer vanishing at those points. Twenty-two equations are enough to solve for 11 unknown positions and 11 unknown values. The format bits (the strips next to the big squares) carry their own separate BCH code, and they're stored twice.