Also known as LFSR. Builds a keystream from a register of bits , where each new bit is the XOR of a fixed subset of the current bits.
In an LFSR, the register is a row of 1-bit memory cells. Its contents are the current -bit state. Each clock tick outputs 1 designated bit, shifts every cell’s bit to the next cell, then inserts the feedback bit into the vacant cell.
-
the feedback taps, fixed for a given LFSR.
-
the initial state, acting as the secret key or seed.
Connection Polynomial
Also known as feedback polynomial. A connection polynomial encodes an LFSR’s feedback recurrence as coefficients of a polynomial. It is not a separate part of the LFSR.
The coefficient is iff feeds into the new bit . A coefficient of omits that tap. The polynomial therefore describes the LFSR’s wiring independently of its initial state.
The constant is fixed by convention. It represents the new bit after the recurrence is moved to 1 side.
It is not a tap. Over , subtraction and addition are identical. Some texts use the reversed characteristic polynomial instead. Its fixed coefficient is the leading term.
Primitive Polynomial
A degree- polynomial over is primitive iff it is irreducible and any root has multiplicative order in . Its successive powers therefore generate every nonzero field element.
To test whether a degree- polynomial is primitive, first check that it is irreducible over . Let . For every prime factor of , compute . The polynomial is primitive iff none of these remainders equals 1.
The output sequence has period , the maximum possible for an -bit register, iff is a primitive polynomial over .
A non-primitive connection polynomial still produces a periodic sequence, just with a period shorter than , and possibly a period that depends on the initial state.
Key Space
With a fixed public connection polynomial, the initial -bit state is the key. The all-zero state is excluded because it remains zero forever. The key space therefore has members.
Characteristic Polynomial
A characteristic polynomial is algebraic notation for the feedback rule. The LFSR does not evaluate this polynomial while it shifts. It lets finite-field algebra determine properties of the recurrence, especially its period.
Replace the new bit with . Replace each delayed bit with . The feedback rule then becomes the characteristic polynomial.
For , the characteristic polynomial is . It records exactly the same recurrence. It is not a different LFSR.
The connection polynomial records the same coefficients in reverse order. Some texts use as their connection-polynomial convention.
is primitive over iff is. Either polynomial can be used to test whether the LFSR has maximal period.
Combining LFSRs
An LFSR alone fails the unpredictability requirement of a secure keystream generator, since its recurrence is linear. Practical generators instead combine several LFSRs of different lengths and connection polynomials through a nonlinear Boolean function .
- the output bit of the -th LFSR at step .
- a fixed nonlinear function of the component outputs.
Clock Control
Component LFSRs need not advance together. A clock-control function can select which registers advance at each step from their current output bits. Irregular clocking disrupts the fixed alignment between component sequences and the output keystream.
Clock control must not leave a component’s output statistically detectable in the resulting keystream.
Security
A combining or clock-control function must satisfy several properties for the resulting keystream to resist analysis.
- Balance
outputs 0 and 1 equally often across all input combinations, so the keystream carries no statistical bias. - High nonlinear order
cannot be approximated by a linear or affine function of its inputs, since a close linear approximation reduces the combiner to a single large LFSR. - Correlation immunity
is statistically independent of each individual , so no component LFSR’s output correlates with the combiner’s output.
A higher correlation immunity order generally forces a lower achievable nonlinear order, so the 2 properties trade off against each other rather than maximising independently.
Attacking
Berlekamp-Massey Algorithm
Targets a single LFSR directly, exploiting the linearity of its recurrence.
- consecutive output bits give linear equations in the unknown taps .
- Solving this system (the Berlekamp-Massey algorithm does so in ) recovers every tap and the state at that point.
- The attacker then computes every following output bit from the recurrence.
Correlation Attack
Targets a combined generator whose combining function correlates with 1 of its component LFSRs.
- The attacker guesses the connection polynomial of the correlated LFSR (public in most designs) and searches over its possible initial states.
- Each candidate state produces a candidate output sequence, compared against the keystream bit by bit.
- The candidate whose sequence agrees with the keystream noticeably more than of the time is accepted as the recovered state.
This reduces recovering an -LFSR generator’s full state from 1 search of size to separate searches of size each, so correlation immunity directly defends against it.
If clock control repeatedly holds 1 component’s output while another advances, the output can retain detectable structure from the held component. Statistical tests can then reveal its period or state.
Example
Take with connection polynomial , so , and initial state .
Solution Reveal Hide
| Output | |||
|---|---|---|---|
| 4 | 1000 | 1 | |
| 5 | 0001 | 1 | |
| 6 | 0011 | 1 | |
| 7 | 0111 | 1 | |
| 8 | 1111 | 0 | |
| 9 | 1110 | 1 |
Continuing the recurrence for 15 steps cycles through every nonzero state of the register once before repeating, giving the maximal period , confirming is primitive over .