How this calculator works
The rightmost bit is emitted before each right shift. In Fibonacci mode the new left bit is the parity of the tapped state bits. Galois mode shifts first and XORs the mask when the emitted bit is 1. Here XNOR complements that parity or Galois trigger. Tap conventions differ between references, so use this stated orientation when comparing results. A cycle search is bounded at 10,000 shifts.
Formula
Fibonacci: next = (state >> 1) OR (parity(state AND mask) × 2^(width-1)). Galois: next = (state >> 1) XOR (output ? mask : 0).
Worked example
For state 001 and Fibonacci XOR mask 101, the states begin 001, 100, 110, 111. The first three output bits are 100. After seven shifts the initial state returns.
Advertisement
Frequently asked questions
Do leading zeros matter?
Yes. They set the register width, so 001 and 1 describe different registers.
Does every tap mask give a maximal period?
No. A primitive feedback polynomial with a suitable non-zero XOR seed can reach 2^w - 1 states. Other masks can have shorter cycles or transients.
Can this generate secure keys?
A plain LFSR is predictable from enough output. This simulator is for studying recurrences and digital logic.