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

后端 未结 23 1630
天命终不由人
天命终不由人 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:45

    Very simply, since networks obey prescribed rules, the results are not random.

    The webcam idea sounds (slightly) reasonable. Linux people often recommend simply using the random noise from a soundcard which has no mic attached.

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

    No.

    Unplug the network cable (or /etc/init.d/networking stop) and the entropy basically drops to zero.

    Perform a Denial-Of-Service attack on the machine it's pinging and you also get predictable results (the ping-timeout value)

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

    No mathmatical computation can produce a random result but in the "real world" computers don't exactly just crunch numbers... With a little bit of creativity it should be possible to produce random results of the kind where there is no known method of reproducing or predicting exact outcomes.

    One of the easiest to implement ideas I've seen which works universally on all systems is to use static from the computers sound card line in/mic port.

    Other ideas include thermal noise and low level timing of cache lines. Many modern PCs with TPM chips have encryption quality hardware random number generators already onboard.

    My kneejerk reaction to ping (esp if using ICMP) is that your cheating too blatently. At that point you might as well whip out a giger counter and use background radiation as your random source.

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

    Eh, I find that this kind of question leads into discussions about the meaning of 'truly random' pretty quickly.

    I think that measuring pings would yield decent-quality random bits, but at an insufficient rate to be of much use (unless you were willing to do some serious DDOSing).

    And I don't see that it would be any more random than measuring analogue/mechanical properties of the computer, or the behaviour of the meatbag operating it.

    (edit) On a practical note, this approach opens you up to the possibility of someone on your network manipulating your 'random' number generator.

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

    I guess you could. A couple things to watch out for:

    • Even if pinging random IP addresses, the first few hops (from you to the first real L3 router in the ISP network) will be the same for every packet. This puts a lower bound on the round trip time, even if you ping something in a datacenter in that first Point of Presence. So you have to be careful about normalizing the timing, there is a lower bound on the round trip.
    • You'd also have to be careful about traffic shaping in the network. A typical leaky bucket implementation in a router releases N bytes every M microseconds, which effectively perturbs your timing into specific timeslots rather than a continuous range of times. So you might need to discard the low order bits of your timestamp.

    However I would disagree with the premise that there are not good sources of entropy in commodity hardware. Many x86 chipsets for the last few years have included random number generators. The ones I am familiar with use relatively sensitive ADCs to measure temperature in two different locations on the die, and subtract them. The low order bits of this temperature differential can be shown (via Chi-squared analysis) to be strongly random. As you increase the processing load on the system the overall temperature goes up, but the differential between two areas of the die remains uncorrelated and unpredictable.

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

    It's not as good as using atmospheric noise but it's still truly random since it depends on the characteristics of the network which is notorious for random non-repeatable behavior.

    See Random.org for more on randomness.

    Here's an attempt at an implementation:

    @ips  : list = getIpAddresses();
    @rnd         = PseudorandomNumberGenerator(0 to (ips.count - 1));
    
    @getTrueRandomNumber() { ping(ips[rnd.nextNumber()]).averageTime }
    
    0 讨论(0)
提交回复
热议问题