Range Redesign: Empty Ranges

Adam Wilson flyboynw at gmail.com
Wed Mar 6 06:51:47 UTC 2024


On Wednesday, 6 March 2024 at 00:23:26 UTC, H. S. Teoh wrote:
> A periodically-reseeded RNG is indeed a practically infinite 
> range, with no cycling.  You don't have to grab every value 
> from the hardware entropy source; it suffices to use a 
> cryptographic hash function on a counter that's periodically 
> reseeded from the hardware entropy. It can literally generate 
> an endless stream of random numbers.
>
>
> T

That is true in theory, but in practice if you try it on real 
hardware, not only will you pay some pretty serious performance 
penalties as the CPU tries to dump all that entropy, it will be 
dumping it to memory, of which you will eventually run out. So 
yes, it's theoretically unlimited, but in practice, there is no 
valid reason to actually implement it that way, and to-date, no 
modern Operating System entropy source allows you to. For 
example, on Windows, you'll be passing a fixed size buffer to the 
entropy source. Same with OpenSSL.

We do not design code for what is theoretically possible, only 
that which can actually be achieved. I know, because I wrote a 
Crypto library for D that specifically deals with this.


More information about the Digitalmars-d mailing list