[Python-ideas] Should our default random number generator be secure?
Donald Stufft
donald at stufft.io
Wed Sep 9 19:31:35 CEST 2015
On September 9, 2015 at 1:19:34 PM, Serhiy Storchaka (storchaka at gmail.com) wrote:
> On 09.09.15 19:35, Guido van Rossum wrote:
> > I've invited Theo to join this list but he's too busy. The two core
> > Python experts on the random module have given me opinions suggesting
> > that there's not much wrong with MT, so here I am. Who is right? What
> > should we do? Is there anything we need to do?
>
> Entropy -- limited and slowly recoverable resource (especially if there
> is no network activity). If you consume it too quickly (for example in a
> scientific simulation or in a game), it will not have time to recover,
> that will slow down not only your program, but all consumers of entropy.
> The use of random.SystemRandom by default looks dangerous. It is
> unlikely that all existing programs will be rewritten to use
> random.FastInsecureRandom.
>
This isn’t exactly true. Hardware entropy limited and slowly recovering which
is why no sane implementation uses that except to periodically reseed the
CSPRNG which is typically based on ARC4 or ChaCha. The standard CSPRNGs that
most platforms use are fast enough for most people's use cases.
-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA
More information about the Python-ideas
mailing list