Skip to content

test: Reed-Solomon cannot see that the derandomiser was skipped - #4

Merged
mysma-9403 merged 2 commits into
mainfrom
test/rs-cannot-see-the-randomiser
Oct 11, 2026
Merged

mysma-9403 merged 2 commits into
mainfrom
test/rs-cannot-see-the-randomiser

Conversation

@mysma-9403

Copy link
Copy Markdown
Contributor

The pipeline is synchronise → derandomise → Reed-Solomon, and this repository's own
ARCHITECTURE.md had that order backwards once already. Why it matters is not obvious, so it
is a test now instead of a sentence.

RS(255,223) is linear over GF(2⁸): the sum of two codewords is a codeword, and over GF(2) that
sum is XOR. The 255-octet randomiser sequence of CCSDS 131.0-B-5 §10.4 turns out to be a
codeword itself. A randomised frame is therefore codeword XOR sequence — which is a
codeword, exactly, with zero syndromes.

So a block nobody derandomised decodes clean:

randomised block differs from the frame in 255 of 255 symbols
Reed-Solomon accepts it, 0 corrected

The error-correcting code is blind to the one mistake somebody reordering this pipeline would
make. There is no diagnostic to add; the order is the whole defence.

The test asserts all three legs: the sequence decodes as a codeword, arbitrary bytes of the
same length do not (so the first leg is not vacuous), and a real encoded frame that was
randomised comes back Ok(0) and wrong in every symbol.

532 tests, fmt and clippy clean.

The pipeline is sync, derandomise, Reed-Solomon, and the ordering has been wrong
in this repository's own prose once already. The reason it matters is not
obvious and is now a test rather than a sentence.

RS(255,223) is linear over GF(2^8), so the sum of two codewords is a codeword,
and over GF(2) that sum is XOR. The 255-octet randomiser sequence of CCSDS
131.0-B-5 10.4 is itself a codeword. A randomised frame is therefore
`codeword XOR sequence` — a codeword, exactly, with zero syndromes.

So a block that has not been derandomised decodes clean, reports zero
corrections, and disagrees with the frame it came from in all 255 of its 255
symbols. The error-correcting code is blind to the one mistake somebody
reordering this pipeline would make. The test asserts all three: the sequence
decodes as a codeword, arbitrary bytes of the same length do not, and a
randomised real frame comes back Ok(0) and wrong everywhere.
E=16 and E=32 take consecutive roots from the same generator, so RS(255,223)
is a subcode of RS(255,239) and the trap holds for both. Asserted rather than
reasoned about, and the frame length now comes from the code instead of being
223 twice.
@mysma-9403
mysma-9403 merged commit 72042ce into main Oct 11, 2026
1 check passed
@mysma-9403
mysma-9403 deleted the test/rs-cannot-see-the-randomiser branch October 11, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant