[pycrypto] winrandom alternative (Namely for 64-bit Windows

Larry Bates larry.bates at vitalesafe.com
Fri Aug 27 12:50:22 CST 2010

os.urandom works on my 64-bit Windows 7 machine (ActiveState Python V2.7).

I think you can use the following to determine if 32/64bit:

import platform
if platform.architecture()[0] == '64bit':
    # Do 64 bit stuff here
    # Do 32 bit stuff here

Larry Bates
vitalEsafe, Inc.

Message: 1
Date: Fri, 27 Aug 2010 01:02:15 -0400
From: "Dwayne C. Litzenberger" <dlitz at dlitz.net>
Subject: Re: [pycrypto] winrandom alternative (Namely for 64-bit
To: PyCrypto discussion list <pycrypto at lists.dlitz.net>
Message-ID: <20100827050215.GA4397 at rivest.dlitz.net>
Content-Type: text/plain; charset=us-ascii; format=flowed

On Tue, Aug 24, 2010 at 04:03:33PM -0400, Gregory Taylor wrote:
>As you are probably aware of, PyCrypto tries to download/compile 
>winrandom, which can be a problem for many that lack a compiler. As an 
>alternative for those who can't/won't install winrandom, I put together a 
>ctypes equivalent that doesn't require compilation like the original 
>winrandom. This new module aims to be functionally equivalent in every way 
>to winrandom, but accesses the Windows-specific cryptography library 
>through ctypes rather than a compiled Python C extension module.

Does os.urandom work on Win64?  We could just use that if someone would 
help me with the OS detection (see lib/Crypto/Random/OSRNG/__init__.py).

Dwayne C. Litzenberger <dlitz at dlitz.net>
  OpenPGP: 19E1 1FE8 B3CF F273 ED17  4A24 928C EC13 39C2 5CF7

More information about the pycrypto mailing list