A Java implementation of the Geffe generator - a keystream generator that combines three LFSRs through a nonlinear function.
The Geffe generator is a classic nonlinear combination generator used to build a stream-cipher keystream. A single linear-feedback shift register (LFSR) has low linear complexity and can be reconstructed from a short fragment of its output by solving a system of linear equations; the Geffe construction raises the linear complexity by combining three LFSRs of distinct lengths with the nonlinear function
f(x1, x2, x3) = x1·x2 ⊕ x2·x3 ⊕ x3
in which one register acts as a selector, passing one of the other two registers through to the output.
The implementation is split into small, focused classes:
Polynomial- builds a feedback polynomial from its tap positions.LFSR- a Fibonacci-style shift register driven by a feedback polynomial: it outputs the low bit and feeds back the parity of the tapped bits.GeffeGenerator- combines three LFSRs and emits the keystream (gamma).Main- a demo harness that seeds three registers of degrees 30, 31 and 32, generates the keystream, prints each register's output stream, and checks the combined gamma against a bundled reference sequence (result.txt).
Released under the MIT License. See LICENSE.