Could a truly random number be generated using pings to pseudo-randomly selected IP addresses?

后端 未结 23 1632
天命终不由人
天命终不由人 2021-01-30 16:28

The question posed came about during a 2nd Year Comp Science lecture while discussing the impossibility of generating numbers in a deterministic computational device.

Th

相关标签:
23条回答
  • 2021-01-30 16:37

    Yes, it's possible, but... the devil's in the details.

    If you're going to generate a 32-bit integer, you need to gather >32 bits of entropy (and use a sufficient mixing function to get that entropy spread around, but that's known and doable). The big question that is:

    how much entropy do ping times have?

    The answer to this question depends on all sorts of assumptions about the network and your attack model, and there's different answers in different circumstances.

    If attackers are able to totally control ping times, you get 0 bits of entropy per ping, and you can't ever total 32-bits of entropy, no matter how much you mix. If they have less than perfect control over ping times, you'll get some entropy, and (if you don't overestimate the amount of entropy you're gathering) will get perfectly random 32-bit numbers.

    0 讨论(0)
  • 2021-01-30 16:39

    YouTube shows a device in action: http://www.youtube.com/watch?v=7n8LNxGbZbs

    Random is, if nobody can predict the next state.

    0 讨论(0)
  • 2021-01-30 16:40

    It seems to me that true randomness is ineffable - there is no way to know whether a sequence is random, since by definition it can contain anything no matter how improbable. Guaranteeing a particular distribution pattern reduces the randomness. The word "pattern" is a bit of a giveaway.

        I MADE U A RANDOM NUMBER
               BUT I EATED IT
    
    0 讨论(0)
  • 2021-01-30 16:41

    It doesn't strike me as a good source of randomness.

    What metric would you use -- the obvious one is response time, but the range of values you can reasonably expect is small: a few tens of milliseconds to a few thousand. The response times themselves will follow a bell curve and not be randomly distributed across any interval (how would you choose the interval?) so you would have to try and select a few 'random' bits from the numbers.

    The LSB might give you a random bit stream, but you would have to consider clock granularity issues - maybe due to how interrupts work you would always get multiples of 2ms on some systems.

    There are probably much better 'interesting' ways of getting random bits -- maybe google for a random word, grab the first page and choose the Nth bit from the page.

    0 讨论(0)
  • 2021-01-30 16:41

    You can use the XKCD method:

    Random Number Generator

    0 讨论(0)
  • 2021-01-30 16:42

    Randomness is not a binary property -- it's a value between 0 and 1 that describes how difficult it is to predict the next value in a stream.

    Asking "how random can my values be if I base them on pings?" is actually asking "how random are pings?". You can estimate that by gathering a large enough set of data (1 mln pings for example) and mapping their distribution curve and behavior in time. If the distribution is flat and the behavior is difficult to predict, the data seems more random. The more bumpy distribution or predictable behavior suggest lower randomness.

    You should also consider the sample resolution. I could imagine the results being rounded in some way to a milisecond, so with pings you could have integer values between 0 and 500. That's not a lot of resolution.

    On the practical side, I would recommend against it, since pings can be predicted and manipulated, further reducing their randomness.

    Generally, I suggest against "rolling your own" randomness generators, encryption methods and hashing algorithms. As fun as it seems, it's mostly a lot of very intimidating math.

    As to how to build a really good entropy generator -- I think that's probably going to have to be a sealed box that outputs some sort of result of interactions on atomic or sub-atomic level. I mean, if you're using a source of entropy that the enemy can easily read too, he only needs to find out your algorythm. Any form of connection is a possible attack vector, so you should place the source of entropy as close to the service that consumes it as possible.

    0 讨论(0)
提交回复
热议问题