What is the most secure seed for random number gen

2019-01-05 09:38发布

What are the most secure sources of entropy to seed a random number generator? This question is language and platform independent and applies to any machine on a network. Ideally I'm looking for sources available to a machine in a cloud environment or server provided by a hosting company.

There are two important weaknesses to keep in mind. The use of time for sending a random number generator is a violation of CWE-337. The use of a small seed space would be a violation of CWE-339.

20条回答
叛逆
2楼-- · 2019-01-05 09:44

Write an Internet radio client, use a random sample from the broadcast. Have a pool of several stations to choose from and/or fall back to.

查看更多
一纸荒年 Trace。
3楼-- · 2019-01-05 09:44

Your most secure methods will come from nature. That is to say, something that happens outside of your computer system and beyond our ability to predict it's patterns.

For instance, many researchers into Cryptographically secure PRNGs will use radioactive decay as a model, others might look into fractals, and so forth. There are existing means of creating true RNGs

One of my favorite ways of implementing a PRNG is from user interaction with a computer. For instance, this post was not something that could be pre-determined by forward-engineering from my past series of posts. Where I left my mouse on my screen is very random, the trail it made is also random. Seeing from user-interactions is. Abuse from the means of providing specific input such that specific numbers are generated could be mitigated by using a 'swarm' of user inputs and calculating it's 'vector', as long as you do not have every user in your system as an Eve, you should be fine. This is not suitable for many applications, as your pool of numbers is directly proportional to user input. Implementing this may have it's own issues.

People interested in RNG have already done things such as:

  1. Use a web cam, whatever the random blips in the screen hash out to, when that truck passes by, that's all random data.
  2. As mentioned already, radiation
  3. Atmosphere
  4. User interaction (as mentioned)
  5. What's going on within the system EDG.

Secure seeds come from nature.

edit: Based on what you're looking at doing, I might suggest using an aggregation of your cloud server's EDG.

查看更多
劫难
4楼-- · 2019-01-05 09:47

The most secure seed is a truly random one, which you can approximate in practical computing systems of today by using, listed in decreasing degrees of confidence:

  • Special hardware
  • Facilities provided by your operating system that try to capture chaotic events like disk reads and mouse movements (/dev/random). Another option on this "capture unpredictable events" line is to use an independent process or machine that captures what happens to it as an entropy pool, instead of the OS provided 'secure' random number generator, for an example, see EntropyPool
  • Using a bad seed (ie, time) and combine it with other data only known to you (for instance, hashing the time with a secret and some other criteria such as PIDs or internal state of the application/OS, so it doesn't necessarily increase and decrease according to time)
查看更多
三岁会撩人
5楼-- · 2019-01-05 09:47

Random.org offers a true random number generator web service, "seeded" by the atmospheric noise.

You get 200,000 random bits for free each day, up to the 1 million random bits cap after that you should top up your account, it gets as cheap as 4 million bits per dollar.

查看更多
等我变得足够好
6楼-- · 2019-01-05 09:52

4 - chosen by very random dice roll. :-)

查看更多
做个烂人
7楼-- · 2019-01-05 09:54

Use random.org they claim to offer true random numbers to anyone on the Internet and they also have an HTTP API which you can use. They offer both free and paid services.

disclaimer: i am not in any way affiliated with random.org

查看更多
登录 后发表回答