I'm trying to get a key with a certain length.When i do test i don't get the length that i want for example (k=500 i get a key of length 301 or 302) with the both statements getrandbits
or with randrange
, my code :
def generate_prime(k,d):
temp=1
while not millerRabin(temp,d):
temp=getrandbits(k)
#temp= randrange(1 << k-1, 1 << k)
return temp
and when i try this i get 301 of length :
k=500
print(len(str(generate_prime(k,40))))
Aucun commentaire:
Enregistrer un commentaire