[Python-Dev] Re: [slightly OT] cryptographically strong random.SystemRandom()

2021-07-12 Thread Thomas Grainger
https://docs.microsoft.com/en-us/windows/win32/seccng/cng-portal ? On Mon, 12 Jul 2021, 23:18 Dan Stromberg, wrote: > > On Mon, Jul 12, 2021 at 8:37 AM Steve Dower > wrote: > >> On 7/12/2021 4:11 PM, Dan Stromberg wrote: >> > It looks like CPython could do better on Windows: SystemRandom (becau

[Python-Dev] Re: [slightly OT] cryptographically strong random.SystemRandom()

2021-07-12 Thread Dan Stromberg
On Mon, Jul 12, 2021 at 8:37 AM Steve Dower wrote: > On 7/12/2021 4:11 PM, Dan Stromberg wrote: > > It looks like CPython could do better on Windows: SystemRandom (because > > of os.urandom()) is good on Linux and mac, but on Windows they use the > > CryptGenRandom deprecated API > > > > Supp

[Python-Dev] Re: [slightly OT] cryptographically strong random.SystemRandom()

2021-07-12 Thread Wes Turner
"PEP 543 -- A Unified TLS API for Python" could specify a [CS][P][RNG] interface that could be used instead of os.urandom, which is probably also wrong. PEP 543 compares OpenSSL, SecureTransport, SChannel, and NSS; which presumably all have some sort of a CSPRNG function that may or may not need

[Python-Dev] Re: [slightly OT] cryptographically strong random.SystemRandom()

2021-07-12 Thread Steve Dower
On 7/12/2021 4:11 PM, Dan Stromberg wrote: It looks like CPython could do better on Windows: SystemRandom (because of os.urandom()) is good on Linux and mac, but on Windows they use the CryptGenRandom deprecated API Supporting detail: https://docs.microsoft.com/en-us/windows/win32/api/win

[Python-Dev] Re: [slightly OT] cryptographically strong random.SystemRandom()

2021-07-12 Thread Dan Stromberg
On Fri, Jul 9, 2021 at 2:26 PM Tim Peters wrote: > [Ethan Furman] > > A question [1] has arisen about the viability of `random.SystemRandom` in > > Pythons before and after the secrets module was introduced > > (3.5 I think) -- specifically > > > > does it give independent and uniform discre

[Python-Dev] Re: [slightly OT] cryptographically strong random.SystemRandom()

2021-07-10 Thread Wes Turner
* Citation: https://cryptography.io/en/latest/random-numbers/ On Sat, Jul 10, 2021 at 7:53 PM Wes Turner wrote: > FWIW, here is what https://cryptography.io has re: random (/? rng python > cryptography) > > ```rst > Random number generation > > > When generating random d

[Python-Dev] Re: [slightly OT] cryptographically strong random.SystemRandom()

2021-07-10 Thread Wes Turner
FWIW, here is what https://cryptography.io has re: random (/? rng python cryptography) ```rst Random number generation When generating random data for use in cryptographic operations, such as an initialization vector for encryption in :class:`~cryptography.hazmat.primitiv

[Python-Dev] Re: [slightly OT] cryptographically strong random.SystemRandom()

2021-07-09 Thread Ethan Furman
On 7/9/21 2:25 PM, Tim Peters wrote: > `secrets` is just a wrapper around `random.SystemRandom`, so the > presence or absence of `secrets` doesn't matter. > > As to SystemRandom, all answers depend on the quality of the platform > os.urandom(), which Python has no control over. See my answer here

[Python-Dev] Re: [slightly OT] cryptographically strong random.SystemRandom()

2021-07-09 Thread Tim Peters
[Ethan Furman] > A question [1] has arisen about the viability of `random.SystemRandom` in > Pythons before and after the secrets module was introduced > (3.5 I think) -- specifically > > does it give independent and uniform discrete distribution for > cryptographic purposes across CPytho