-
galois.GLFSR.reset(state: ArrayLike | None =
None) Resets the Galois LFSR state to the specified state.
- Parameters:¶
Examples¶
Step the Galois LFSR 10 steps to modify its state.
In [1]: feedback_poly = galois.primitive_poly(7, 4).reverse(); feedback_poly Out[1]: Poly(5x^4 + 3x^3 + x^2 + 1, GF(7)) In [2]: lfsr = galois.GLFSR(feedback_poly); lfsr Out[2]: <Galois LFSR: f(x) = 1 + x^2 + 3x^3 + 5x^4 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, 0, 4, 6, 5, 3, 6, 1, 2], order=7) In [5]: lfsr.state Out[5]: GF([4, 3, 0, 1], order=7)Reset the Galois LFSR state.
In [6]: lfsr.reset() In [7]: lfsr.state Out[7]: GF([1, 1, 1, 1], order=7)Create an Galois LFSR and view its initial state.
In [8]: feedback_poly = galois.primitive_poly(7, 4).reverse(); feedback_poly Out[8]: Poly(5x^4 + 3x^3 + x^2 + 1, GF(7)) In [9]: lfsr = galois.GLFSR(feedback_poly); lfsr Out[9]: <Galois LFSR: f(x) = 1 + x^2 + 3x^3 + 5x^4 over GF(7)> In [10]: lfsr.state Out[10]: GF([1, 1, 1, 1], order=7)Reset the Galois 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)