Guest User

Untitled

a guest
May 8th, 2012
665
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. import random
  2. import os
  3. from Crypto.Util import number
  4.  
  5. random.seed(os.getpid())
  6.  
  7. def randfunction(N):
  8.     # N is in bytes
  9.     # pycrypto expects a string
  10.     l = []
  11.     while N > 0:
  12.         l.append(chr(random.getrandbits(8)))
  13.         N -= 1
  14.     return "".join(l)
  15.  
  16. p = number.getPrime(512, randfunction)
  17. q = number.getPrime(512, randfunction)
  18. n = p*q
Advertisement
Add Comment
Please, Sign In to add comment