Field Guide · algorithm

Also known as: scrambling, whitening, data randomization

Scrambling (whitening) XORs the data stream with a public pseudo-random sequence to break up long runs of identical bits.1 Those runs are the enemy of a receiver: a long string of zeros or ones has no transitions to lock a clock-recovery loop onto, and it pushes a DC bias into the signal that AC-coupled and FM front ends handle badly. Whitening scatters the bits so transitions stay frequent and the average stays balanced, regardless of what the payload happens to be. Because the sequence is standardised and known to everyone, scrambling is not encryption — the receiver undoes it with the same operation.

dataLFSR PRBS gen whitened stream balances 1s and 0s and guarantees transitions for the clock
An additive scrambler XORs the payload with an LFSR-generated pseudo-random bit sequence; the receiver XORs the identical sequence to recover the data.

How it works

The pseudo-random sequence is produced by a linear-feedback shift register whose feedback taps are set to a primitive polynomial, giving a maximal-length sequence that looks random and repeats only after 2ⁿ−1 bits. XORing data with such a sequence “whitens” it: the output power spectrum flattens, 1s and 0s occur about equally often, and there are no long constant runs — exactly the properties a symbol-timing loop and an AGC want to see. Because XOR is its own inverse, whitening is perfectly reversible: (data ⊕ seq) ⊕ seq = data.

Variants

  • Additive (synchronous) scrambler. The LFSR runs free, driven only by a bit clock, and its output is XORed with the data. It must be synchronised — the receiver’s LFSR has to start in the same state at the same bit, usually by resetting to a known seed at the start of each frame or after a sync word. It does not propagate errors: one channel bit error causes exactly one descrambled bit error, which is why it pairs cleanly with FEC.
  • Multiplicative (self-synchronising) scrambler. The feedback is taken from the transmitted (scrambled) stream itself, so the receiver’s descrambler locks on automatically after a few bits with no explicit seed — but a single channel error is fed back through the taps and multiplies into several output errors. Used in SONET/SDH and some modem standards where re-sync must be automatic.
  • Related line coding. Whitening is often combined with a transition-guaranteeing line code such as NRZI or Manchester; the two together nail down both DC balance and a recoverable clock.

In practice

The scrambler’s polynomial and seed are part of the protocol specification, so decoding is purely mechanical once you know them. Where scrambling causes confusion is that a synchronous scrambler looks like nonsense until the receiver’s LFSR is aligned to the frame; miss the seed or the reset point and every bit is wrong even though the demodulation was perfect. This makes the seed/reset timing a common thing to get right when bringing up a new decoder.

Relevance to SDR

Whitening appears throughout digital radio and wireline: DMR applies a defined scrambling sequence to its bursts, Bluetooth and Wi-Fi whiten their payloads, GPS spreads with PRN codes in the same LFSR family, and DVB scrambles its transport stream for spectral shaping. For a receiver like GopherTrunk the practical point is that whitening is reversible and keyless: a scrambled-but-unencrypted signal decodes completely once the standard sequence is applied, unlike a stream protected by real RC4-style or AES encryption, whose keystream is secret. GopherTrunk descrambles the protocols that whiten their bursts as an ordinary step in the decode chain — it is data conditioning to undo, not a cipher to break.

Sources

  1. Scrambler — Wikipedia, for additive vs multiplicative scramblers, DC balance, and the distinction from encryption. 

See also