[Python-ideas] Should our default random number generator be secure?

Stefan Krah skrah at bytereef.org
Wed Sep 9 20:00:59 CEST 2015

Tim Peters <tim.peters at ...> writes:
> > We'd use /dev/urandom, one of the syscalls that
> > do the same thing, or the CryptGen API on Windows. Python should not
have it's
> > own userland CSPRNG.
> I read Guido's message as asking whether Python should indeed do just that.

>From Theo's forwarded mail I also got the impression that he wanted
us to use OpenBSD code to implement our own CSPRNG, use that for
the default functions in the random module and add new functions
for reproducible random numbers that use the MT.

My intuition is that if someone just uses a random() function
without checking if it's cryptographically secure then the
application will probably have other holes as well.  I mean,
for example no one is going to use C's rand() function for crypto.

Stefan Krah

More information about the Python-ideas mailing list