How often does /dev/urandom sample seeding from /dev/random

random number generator

Unless I am totally confused and it doesn't do that.

I want to know whether or not /dev/urandom will gain increased entropy if I take a hardware RNG and plug its entropy into /dev/random.

So to rephrase, if I were to increase the entropy of /dev/random by X bits/sec (that is, /dev/random after injection lets you sample X bits/sec) will that increased entropy transfer over to urandom?

Best Answer

It isn't really accurate to say that /dev/urandom samples from /dev/random. Instead, the two pools are backed by the same source of entropy. When the pools' entropy count reaches zero, they reseed from the shared input pool. So if you give the kernel input entropy in some way, it can use that for either /dev/random or /dev/urandom, depending on which gets read.

However, /dev/urandom is also rate-limited in how often it can ask for reseeding. By default it can only reseed once every 60 seconds.

None of that really matters in practice, because as long as the pool is initially seeded with at least 128 bits or so of entropy, predicting any output would require not only seeing previous outputs but also breaking the algorithms used, including at least the preimage resistance of SHA-1 (which remains unbroken).