galois.FLFSR.reset(state: = None)

Resets the Fibonacci LFSR state to the specified state.

Parameters:
state: = None

The state vector $$S = [S_0, S_1, \dots, S_{n-2}, S_{n-1}]$$. The default is None which corresponds to the initial state.

Examples

Step the Fibonacci LFSR 10 steps to modify its state.

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

In [2]: lfsr = galois.FLFSR(c.reverse()); lfsr
Out[2]: <Fibonacci LFSR: f(x) = 5x^4 + 3x^3 + x^2 + 1 over GF(7)>

In [3]: lfsr.state
Out[3]: GF([1, 1, 1, 1], order=7)

In [4]: lfsr.step(10)
Out[4]: GF([1, 1, 1, 1, 5, 5, 1, 3, 1, 4], order=7)

In [5]: lfsr.state
Out[5]: GF([5, 5, 6, 6], order=7)


Reset the Fibonacci LFSR state.

In [6]: lfsr.reset()

In [7]: lfsr.state
Out[7]: GF([1, 1, 1, 1], order=7)


Create an Fibonacci LFSR and view its initial state.

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

In [9]: lfsr = galois.FLFSR(c.reverse()); lfsr
Out[9]: <Fibonacci LFSR: f(x) = 5x^4 + 3x^3 + x^2 + 1 over GF(7)>

In [10]: lfsr.state
Out[10]: GF([1, 1, 1, 1], order=7)


Reset the Fibonacci LFSR state to a new state.

In [11]: lfsr.reset([1, 2, 3, 4])

In [12]: lfsr.state
Out[12]: GF([1, 2, 3, 4], order=7)