I am trying to implement a random number generator (which should be cryptographically secure), I am thinking of combining multiple LFSRs, is it a good choice?

I've also heard I can create RNGs from hashing algos like shake256, How is that done?


1 Answer 1


No, they don't even make very strong stream ciphers. A CSPRNG (look it up here) has stronger requirements. If you want an RNG (truly random not pseudorandom) the requirements are different and no software based algorithm can satisfy them.

You can search here on answers relevant to the points I make below.

LFSRs by themselves are insecure, being linear. Look up Berlekamp Massey algorithm.

LFSR combinations via nonlinear functions ((a) either by filtering the state, or (b) by combining the outputs) fare slightly better but are still not secure. Examples include the multiplexing generator, the filter generator, the nonlinear combination generator.

What vulnerabilities does the LFSR filter generator have?

LFSRs with more sophisticated structural elements, such as shrinking generator and self shrinking generator, the alternating step generator have better security. Irregular clocking is another method used to get more security. Their IV-less design make them not so suitable for modern high data rate uses, however.

A5, and its versions (GSM phones) have some structural elements designed to make it more secure, but it was broken.

Is there practical Attack on A5/1 Cryptosystem?

PS: The SHAKE256 question should probably be asked separately, you've really asked two very distinct questions.


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.