I used to think that entropy estimation was nonsense, but last year I finally understood it. Copying my comment at <a href="https:&#x2F;&#x2F;lwn.net&#x2F;Articles&#x2F;642839&#x2F;" rel="nofollow">https:&#x2F;&#x2F;lwn.net&#x2F;Articles&#x2F;642839&#x2F;</a>:<p>Think of the pool&#x27;s entropy as a &quot;measure of unpredictability&quot;. If the entropy is ten bits, for instance, you&#x27;d need at most 1024 guesses to find the pool state.<p>You should think of the random generator as having two separate and independent parts: the pool itself and the output function.<p>Inputs are mixed into the pool using a cryptographic function which takes two values: the previous pool state and the input value, and outputs the new pool state. This function thoroughly mixes its inputs, such that a one-bit difference on any of them would result on average to half of the output bits changing, and other than by guessing it&#x27;s not possible to get from the output back to the inputs.<p>Suppose you start with the pool containing only zeros. You add to it an input containing one bit of entropy. Around half of the pool bits will flip, and you can&#x27;t easily reverse the function to get back the input, but since it&#x27;s only one bit of entropy you can make two guesses and find one which matches the new pool state. Each new bit of entropy added doubles the number of guesses you need to make; but due to the pigeonhole principle, you can&#x27;t have more entropy than the number of bits in the pool.<p>To read from the pool, you use the second part, the output function. It again is a cryptographic function which takes the whole pool as its input, mixes it together, and outputs a number. Other than by guessing, it&#x27;s not possible to get from this output to the pool state.<p>Now let&#x27;s go back to the one-bit example. The pool started with zero entropy (a fixed initial state), and got one bit of entropy added. It can now be in one of two possible states. It goes through the output function, which prevents one reading the output from getting back to the pool state. However, since there were only two possible states (one bit of entropy), you can try both and see which one would generate the output you got... and now the pool state is completely predictable, that is, it now has zero bits of entropy again! By reading from the pool, even with the protection of the output function, you reduced its entropy. Not only that, but there were only two possible outputs, so the output itself had only one bit of entropy, no matter how many bits you had asked for.<p>Now if you read a 32-bit number from a pool with 33 bits of entropy, you can make many guesses and find out a possible pool state. However, again due to the pigeonhole principle, there&#x27;s on average two possible pool states which will generate the same 32-bit output. Two pool states = one bit. So by reading 32 bits, you reduced the remaining entropy to one bit.<p>This is important because if you can predict the pool state, you can predict what it will output next, which is obviously bad.<p>----<p>Now, why isn&#x27;t the situation that bad in practice? First, the input entropy counter tends to underestimate the entropy being added (by design, since it&#x27;s better to underestimate than to overestimate). Second, &quot;by guessing&quot; can take a long enough time to be impractical. Suppose you have a 1024-bit pool, and read 1023 bits from it. In theory, the pool state should be almost completely predictable: there should be only two possible states. In practice, you would have to do more than 2^1000 guesses (a ridiculously large number) before you could actually make it that predictable.<p>However, that only applies after the pool got unpredictable enough. That&#x27;s why the new getrandom() system call (which you should use instead of reading &#x2F;dev&#x2F;random or &#x2F;dev&#x2F;urandom) will always block (or return failure in non-blocking mode) until the pool has gotten enough entropy at least once.