LFSR Calculator

Linear Feedback Shift Register Calculator for Digital Circuits and Cryptography

LFSR Configuration

4 bits

LFSR Visualization

LFSR Output & Analysis

Current Output

Output bit: 0

Generated Sequence

Sequence will appear here...
Period: 0

Feedback Polynomial

P(x) = x⁴ + x + 1

Binary Representation

Polynomial: 1001
Taps at positions: [3, 0]

Current State

State: 0001 (Binary)
Decimal: 1

Step History

Step Register State Output Bit Feedback Bit Decimal

Common LFSR Examples

Click on any example to load it into the calculator:

3-bit LFSR

P(x) = x³ + x² + 1

Period: 7 (Maximal)
4-bit LFSR

P(x) = x⁴ + x + 1

Period: 15 (Maximal)
5-bit LFSR

P(x) = x⁵ + x² + 1

Period: 31 (Maximal)
8-bit LFSR (CRC-8)

P(x) = x⁸ + x⁴ + x³ + x² + 1

Period: 255 (Maximal)
16-bit LFSR

P(x) = x¹⁶ + x¹⁴ + x¹³ + x¹¹ + 1

Period: 65535 (Maximal)
Non-Maximal 6-bit

P(x) = x⁶ + x⁵ + 1

Period: 21 (Non-maximal)

About LFSR

What is LFSR?

A Linear Feedback Shift Register (LFSR) is a shift register whose input bit is a linear function of its previous state. The most commonly used linear function is the XOR of certain bits (taps) of the register.

Applications

  • Pseudorandom Number Generation: For simulations and games
  • Cryptography: Stream ciphers and encryption
  • Digital Communications: CRC error detection
  • Built-in Self-Test (BIST): Circuit testing
  • Scrambling: Data scrambling for transmission

Key Concepts

  • Maximal Length Sequence: Period = 2ⁿ - 1
  • Primitive Polynomial: Generates maximal sequence
  • Feedback Taps: Positions that affect next state
  • Galois vs Fibonacci: Two LFSR configurations
  • Periodicity: Sequence repeats after certain steps

Feedback Polynomial

Represented as P(x) = xⁿ + xᵏ + ... + 1 where:

  • n = Degree (register size)
  • Terms = Tap positions (1 = tap present, 0 = no tap)
  • Binary representation: 1 followed by tap coefficients

LFSR Operation

  1. Output the rightmost bit
  2. Calculate feedback bit by XORing tap positions
  3. Shift all bits right by one position
  4. Insert feedback bit into leftmost position
  5. Repeat to generate sequence
Feedback = bit[tap1] ⊕ bit[tap2] ⊕ ... ⊕ bit[tapk]

Related Tools