I have implemeneted the code for cryptanalysis of LFSR stream cipher . But I have a problem with generation of dataset i.e to get valid pairs using LFSR stream cipher. In the stinson book it is mentioned that if coefficients $$(c0,c1,\dots,cm-1)$$ are chosen in suitable way and if non-zero $$k=(k1,\dots,km)$$ is chosen then we will get a periodic stream cipher with period $2^{m-1}$.

What should be the values of $$c0,c1,\dots,cm-1$$ that I should choose?


1 Answer 1


Firstly using an LFSR output as a keystream generator is insecure, due to the Berlekamp-Massey attack which only needs $2m$ bits of known or guessed plaintext to break the stream with period $2^m-1.$

The coefficients you are asking about, must define a polynomial $$c(x)=c_0+c_1 x +c_{m-1} x^{m-1}+x^m$$ with $c_0=1,$ and $c(x)$ must be primitive. See Wikipedia here.

  • $\begingroup$ I am actually implementing the Berlekamp-Massey attack .. for that I needed a dataset to check my code i.e I need valid (input,output) streams . So I am running some LFSR's to encrypt some PT's . Thanks for the answer anyways $\endgroup$ Commented Nov 14, 2016 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.