solomon
solomon, specimen 001

code

symbols and bits

A Reed–Solomon code adds check symbols to a message. Their pattern identifies both the location and value of a bounded number of damaged symbols. The result is one codeword with a fixed length.

A symbol here is one byte, while a bit is one of the eight positions inside that byte. One flipped bit damages one symbol. Eight flipped bits in that same byte still count as damage to one symbol because correction is measured by symbol positions.

The arithmetic takes place in GF(2^8), a field with 256 elements. Addition is exclusive-or and multiplication reduces by the primitive polynomial 0x11D. Every byte therefore acts as one field element.

code reading: —

parity

The layout is systematic. The first 223 symbols are the message and the final 32 symbols are parity. Reading the first region does not require separating message bytes from a mixed encoding.

The 32 parity bytes are computed from the complete sequence of 223 message bytes. They are chosen so that all 32 syndromes of the complete codeword are zero. A changed message byte or parity byte generally makes those checks nonzero.

A code with 32 parity symbols has minimum distance 33. It corrects 16 unknown symbol errors because each error contributes a location and a magnitude. Damage beyond that bound does not have a guaranteed unique correction.

code reading: —

the field

Parity symbols remain part of the same stored codeword and can be hit by a transfer. A hit in parity consumes correction capacity in the same way as a hit in the message region. The decoded message can remain unchanged while the decoder corrects that parity damage.

The same family of codes appears in compact discs, QR codes, and deep space links. Each use selects parameters suited to its channel. The common rule is that extra symbols provide a measurable distance between valid words.

The reader builds the codeword, counters, recent draws, and repair records from transactions. It starts from the fixed message rather than a stored second copy. The browser derives its decoded view from the replayed codeword.

code reading: —

the current word

The current word begins with the fixed message and its computed parity. Transfers alter individual bits during replay. Burns can restore the lowest damaged symbol.

Parity symbols can be hit like message symbols. Such a hit consumes the same correction capacity. Repairing it costs one symbol unit.

A fixed five-error vector tests the same decoder. It is separate from the live word. Its successful result checks the implementation.

code reading: —

the current codeword
fig. 4 Damaged symbols use the accent; repaired symbols carry a green underline.
systematic layout223 message symbols32
fig. 5 The first 223 symbols are message and the last 32 are parity.
GF(2⁸) multiplication
fig. 6 Each cell represents gfMul(a,b) for byte values 0 through 255.
fixed decoder test000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcddde41841183b11fdb537421939696cda70e1db5c86684af222564b89cc6069f172e
fig. 7 fixed test vector, not the live word
1export function gfMul(a: number, b: number): number {
2 let r = 0;
3 while (b) {
4 if (b & 1) r ^= a;
5 a <<= 1;
6 if (a & 0x100) a ^= 0x11d;
7 b >>= 1;
8 }
9 return r;
10}
from the site source
1export function syndromes(cw: Uint8Array): number[] {
2 const s: number[] = [];
3 let root = 1; // alpha^0
4 for (let j = 0; j < 32; j++) {
5 let acc = 0;
6 for (let i = 0; i < 255; i++) acc = gfMul(acc, root) ^ cw[i];
7 s.push(acc);
8 root = gfMul(root, 2);
9 }
10 return s;
11}
from the site source
terms
symbolone byte
bitone binary position
fieldthe 256-value arithmetic system
parity32 computed check bytes
syndromea codeword field evaluation
distancediffering symbol positions