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

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


Seems that things might be slightly more complicated than I first thought.  Here
is a good thread that covers the topic:

http://www.gossamer-threads.com/lists/python/python/663631

Hope info helps,
Larry Bates
vitalEsafe, Inc.

-----Original Message-----
From: Larry Bates [mailto:larry.bates at vitalesafe.com] 
Sent: Friday, August 27, 2010 1:50 PM
To: 'pycrypto at lists.dlitz.net'
Cc: 'dlitz at dlitz.net'
Subject: winrandom alternative (Namely for 64-bit Windows

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
    #
else:
    #
    # 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
	Windows)
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