Cryptographically random numbers
Tuvas
tuvas21 at gmail.com
Sat Mar 4 18:43:08 EST 2006
Okay, I'm working on devoloping a simple, cryptographically secure
number, from a range of numbers (As one might do for finding large
numbers, to test if they are prime). My function looks like this:
def cran_rand(min,max):
if(min>max):
x=max
max=min
min=x
range=round(log(max-min)/log(256))
if range==0:
range=1
num=max+1
while(num>max):
num=min+s2num(urandom(range))
return num
Any comments on this? I think it should hold up to a test, it seems to
work alright. Thanks!
More information about the Python-list
mailing list