Bytes Add by XOR
The 256 byte values are the elements of GF(2^8); adding two of them adds their binary coefficients without carry, which is XOR.
The question
Reed-Solomon codes compute with bytes, but not with the addition of ordinary numbers: in the field they use, 0xff plus 0x01 is not 0x00. What is the sum of two bytes there, and why does it need no carry? This book builds the field GF(2^8) in small loops, with constructed bytes and no OpenSSL call, and later uses it to encode and rebuild a few bytes. It is a toy-sized code over the field of RFC 5510; the first lesson is only about addition.
Work it by hand
RFC 5510, section 8.1, says that the elements of GF(2^m) can be represented as polynomials with binary coefficients of degree below m, and that the addition of two elements is the addition of binary polynomials in GF(2). For m = 8 a byte is such a polynomial: this book reads bit 0 as the coefficient of 1, bit 1 as the coefficient of x, and so on up to x to the 7th.
Add 0x2d and 0x1b. In binary 00101101 and 00011011, that is x^5 + x^3 + x^2 + 1 and x^4 + x^3 + x + 1. Add the coefficients modulo 2: x^3 cancels and 1 cancels, leaving x^5 + x^4 + x^2 + x, the byte 00110110, 0x36. As numbers the sum would be 0x48.
Run it
The demo adds six pairs of bytes in two ways and writes both results in a table.

Watch the steps (recorded video)
let rows = str_list(); let agree = 0;
let gf = int_list(); let plain = int_list();
for (i in range(0, str_len(left) / 2)) {
gf.add(xor_byte(byte_at(left, i), byte_at(right, i)));
plain.add((byte_at(left, i) + byte_at(right, i)) % 256);
}
for (i in range(0, gf.len())) {
if (gf.at(i) == plain.at(i)) { agree = agree + 1; }
let pair = hex_byte(byte_at(left, i)) + "|" + hex_byte(byte_at(right, i));
rows.add(pair + "|" + hex_byte(gf.at(i)) + "|" + hex_byte(plain.at(i)));
}
let answer = agree;
lmcode_return_put("rows", rows);
{
"answer": 2,
"rows": [
"ff|01|fe|00",
"80|80|00|00",
"1d|8c|91|a9",
"00|00|00|00",
"5a|50|0a|aa",
"a5|a5|00|4a"
]
}Lines 3 to 6 compute both sums of every pair: line 4 is the sum in the field, the exclusive or of the two bytes, and line 5 the ordinary sum modulo 256. Lines 7 to 11 count the rows where the two agree and write the table. The first pair, ff and 01, gives fe in the field and 00 as numbers. The answer on line 12 is the number of rows where the two sums are equal, here 2.
You can change left and right. A shorter right is read as if its missing bytes were 00, and an odd last digit is ignored (measured). A character that is not a hex digit gives nonsense: the left text ffz0 gives the second row 00|80|90|70. The page makes typed hex lower case and removes spaces first.
Your turn
The program below should add two byte strings of the same length in GF(2^8). Several candidate programs are offered. Read them, run them on pairs of your own, and decide which of them is right for every pair. The cases are constructed byte strings.

let answer = "";
for (i in range(0, str_len(a) / 2)) {
let sum = xor_byte(byte_at(a, i), byte_at(b, i));
answer = answer + str(sum);
}
{
"answer": "2520202237"
}Return the sum of the byte strings a and b in GF(2^8) as hex text, two lowercase digits per byte. Each byte is a polynomial with one binary coefficient per bit, and two bytes are added bit by bit with no carry between bits: 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1 and 1 + 1 = 0. The inputs a and b have the same length. Check runs your program on this pair and on five others.
Read the result carefully
There is no carry in this sum, and no byte ever grows past 8 bits. Every element is its own negative: a plus a is 0, so subtracting is the same operation, which the next lessons rely on. The same arithmetic over GF(2) is what a CRC does when it divides: see CRC as Long Division.
The bit order is this book's choice: RFC 5510 writes a vector with the coefficient of 1 first, so its string 101110001 for m = 8 is read left to right, and this page reads a byte with its lowest bit as the coefficient of 1. Nothing here is a cipher, and no real system is shown.
Recap
- A byte is a polynomial over GF(2) with one coefficient per bit.
- Adding two bytes adds each bit modulo 2, with no carry: that is XOR.
- Every byte is its own negative, so a plus a is 0 and subtracting is adding.