Is the first ECC of Reed-Solomon always the same as xor?

Viewed 422

I am working with reed-solomon at the moment. As far, as I understand, the first error correction code is always the same as xor'ing the data words, because the first row of the vandermonde matrix is always 1 and the addition of elements in a galois field is equivalent to xor.

Now I tried to get some code words using the Zxing 3.3.0 implementation of ReedSolomonEncoder. See the following listing in Java:

ReedSolomonEncoder rs = new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256);

int[] codeword = {72,87,0,0};

rs.encode(codeword, 2);
System.out.println("Ecc for " + codeword[0] + " and " + codeword[1]);
System.out.println("XOR: " + (72^87));
System.out.println("RS #1: " + codeword[2]); // Shouldn't this be 31 too?
System.out.println("RS #2: " + codeword[3]);

Which gives the following output:

Ecc for 72 and 87
XOR: 31
RS #1: 28
RS #2: 3

There are two possibilities:

  1. I have a misconception of Reed-Solomon
  2. I am using the implementation in a wrong way (as the javadoc is poorly written)

Or this is a bug, which I somehow do not believe.

1 Answers
Related