[Python-ideas] Pre-PEP Adding A Secrets Module To The Standard Library

Tim Peters tim.peters at gmail.com
Sun Sep 20 01:40:32 CEST 2015

> Thanks! I'd accept this (and I'd reject 504 at the same time). I like the
> secrets name. I wonder though, should the PEP propose a specific set of
> functions? (With the understanding that we might add more later.)

The bikeshedding on that will be far more tedious than the
implementation.  I'll get it started :-)

No attempt to be minimal here.  More-than-less "obvious" is more important:

Bound methods of a SystemRandom instance
        renamed from .getrandbits()
        renamed from private ._randbelow()

 Token functions
        another name for os.urandom()
        same, but return string of ASCII hex digits
        same, but return URL-safe base64-encoded ASCII
    .token_alpha(alphabet, nchars)
        string of `nchars` characters drawn uniformly
        from `alphabet`

More information about the Python-ideas mailing list