[PYTHON-CRYPTO] random number module

Paul Rubin phr-pycrypt at nightsong.com
Mon Jan 27 19:41:03 CET 2003

I'd like to submit a secure RNG module for Python 2.3.  Like block
ciphers, Guido has also expressed interest in this.

I included a Linux implementation in the block cipher reference
implementation that I just sent the url for:


It works by reading pseudo-random bytes from /dev/urandom, i.e. it
lets the kernel do the heavy lifting.  I've been using it for quite
a while and I'm pretty happy with the interface.

There needs to be something similar for Windows, that gets random
bytes by calling CryptGenRandom function in the Windows CAPI,
preferably using a CSP of the user's choice, but it's ok if it uses
the standard Microsoft CSP.  All that's needed is a dll with one or
two entry points, to select the CSP and to read N random bytes with a
CAPI call.  I'd write this, except I'm mostly a Linux user and I don't
have any Windows dev tools.

Are there any Windows programmers here willing to do this?  I'll
provide whatever assistance I can, given that I can't compile or
easily test the code.  But I can help interpret the CAPI documentation
if that's useful.



More information about the python-crypto mailing list