I'm not sure if there is a library that can fit your purpose. I can give you some implementation pointers:
Your implementation is based on LFSR. You can implement one of two ways:
- The Fibonacci implementation consists of a simple shift register in which the total sum of binary-weighted taps modulo-2 is returned back to the input (remember that the sum of mo-2 is equivalent to adding without transfer, which in turn is equivalent to XOR).
- The Galois implementation consists of a shift register, the contents of which are changed at each step by the binary-weighted value of the output stage, again using mathematics modulo 2. The order of the Galois weights is opposite to the Fibonacci weights. The Galois form is usually faster due to the reduction in the amount of logic in the feedback loop.
, , . , ().
. LFSR , . , - . , , ( ).
, !