classmethod galois.FLFSR.Taps(taps: FieldArray, state: ArrayLike | None = None) Self

Constructs a Fibonacci LFSR from its taps T=[cn1,cn2,,c1,c0].

Parameters:
taps: FieldArray

The shift register taps T=[cn1,cn2,,c1,c0].

state: ArrayLike | None = None

The initial state vector S=[S0,S1,,Sn2,Sn1]. The default is None which corresponds to all ones.

Returns:

A Fibonacci LFSR with taps T=[cn1,cn2,,c1,c0].

Examples

In [1]: c = galois.primitive_poly(7, 4); c
Out[1]: Poly(x^4 + x^2 + 3x + 5, GF(7))

In [2]: taps = -c.coeffs[1:]; taps
Out[2]: GF([0, 6, 4, 2], order=7)

In [3]: lfsr = galois.FLFSR.Taps(taps)

In [4]: print(lfsr)
Fibonacci LFSR:
  field: GF(7)
  feedback_poly: 5x^4 + 3x^3 + x^2 + 1
  characteristic_poly: x^4 + x^2 + 3x + 5
  taps: [0 6 4 2]
  order: 4
  state: [1 1 1 1]
  initial_state: [1 1 1 1]