0

So I am trying to get a cryptographically strong random number generator... The thing is, for certain reasons, I would still like to be able to assign a random seed to the generator (it can be a relatively large seed if necessary though).

So in light of this... If one uses a cryptographically strong random generator (like pycrypto's random module, or random.SystemRandom) to generate a random seed for the regular python random module, will the random module have sufficient randomness and entropy to be considered cryptographically strong?

2 Answers 2

2

If one uses a cryptographically strong random generator (like pycrypto's random module, or random.SystemRandom) to generate a random seed for the regular python random module, will the random module have sufficient randomness and entropy to be considered cryptographically strong?

No. Whatever seed you use won't make the default Pseudo Random Number Generator (random.Random) into Cryptographically Strong Pseudo Random Number Generator (random.SystemRandom). See PEP 0506 -- Adding A Secrets Module To The Standard Library.

2
  • Thank you. So if I needed a strong random source that still used a seed, a randomness extractor or similar algorithm would be the way to go? Jan 4, 2016 at 4:09
  • @someone-or-other: there is no seed in random.SystemRandom by design. Whether a CSPRNG exists that accepts a seed (reproducible stream) is a good question (my answer is no but it might be a matter of specific definitions).
    – jfs
    Jan 4, 2016 at 6:53
0

I found an excellent source for getting random numbers manually: https://www.random.org/ They generate random numbers using atmospheric noise. Additionally, they do have an API, so perhaps that is an option.

As far as what would be suitable for cryptographic purposes, the general wisdom is to rely on "true randomness," that is hardware or physical sources of randomness in preference to pseudorandom number generators. You can check the Diceware password generator for some background.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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