Solution
ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2006/ii/paper-1/4g/solution
Past exam of the mathematics course of the University of Cambridge 2006 ii Paper 1 4G Solution by
Codex 0 Created 2026-09-24 Updated 2026-10-14
A binary linear-feedback shift register of length keeps bits and produces a sequence satisfying a recurrenceAfter each output it shifts its stored bits and inserts the feedback bit. Its connection polynomial is . This convention reverses the usual characteristic polynomial .
The Berlekamp-Massey algorithm recovers the shortest recurrence compatible with observed bits. Maintain the current , length , an earlier polynomial that last caused a length increase, and the offset since that increase. Initially . At position calculate the discrepancy . If , advance . If , save and replace by . If also , replace by , by and by one; otherwise increase . Over a general field the correction is , where is the saved nonzero discrepancy. The correction cancels the failed equation while retaining the previous successful ones; when it forces a length increase the smallest possible new length is .
Here, indexing the first bit by zero, the nonzero discrepancies occur at positions . The corresponding updates areEvery subsequent supplied discrepancy is zero. ThusEquivalently the characteristic feedback polynomial is . No length-three recurrence works: positions force , but position six then has nonzero discrepancy. The recovered length is therefore minimal. Observing at least twice the true linear complexity ordinarily identifies the recurrence, after which a known consecutive block determines all future key bits. This is why a bare register is unsuitable as a cryptographic keystream generator; a finite prefix alone does not exclude a longer generator that later diverges.
New to topics? Read the docs here!