[Python-ideas] PEP 504: Using the system RNG by default

M.-A. Lemburg mal at egenix.com
Wed Sep 16 21:09:27 CEST 2015


On 16.09.2015 17:54, Steven D'Aprano wrote:
> I propose:
> 
> - The random module's API is left as-is, including the default PRNG. 
>   Backwards compatibility is important, code-churn is bad, and there are 
>   good use-cases for a non-CSPRNG.
> 
> - We add at least one CSPRNG. I leave it to the crypto-wonks to decide 
>   which.
> 
> - We add a new module, which I'm calling "secrets" (for lack of a better 
>   name) to hold best-practice security-related functions. To start with,
>   it would have at least these three functions: one battery, and two 
>   building blocks:
> 
>   + secrets.token to create password recovery tokens or similar;
> 
>   + secrets.random calls the CSPRNG; it just returns a random number 
>     (integer?). There is no API for getting or setting the state, 
>     setting the seed, or returning values from non-uniform 
>     distributions;
> 
>   + secrets.choice similarly uses the CSPRNG.

+1 on the idea (not sure about the name, though :-))

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Sep 16 2015)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...           http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...           http://zope.egenix.com/
________________________________________________________________________
2015-09-14: Released mxODBC Plone/Zope DA 2.2.3   http://egenix.com/go84
2015-09-18: PyCon UK 2015 ...                               2 days to go
2015-09-26: Python Meeting Duesseldorf Sprint 2015         10 days to go

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/


More information about the Python-ideas mailing list