1. Sybren Stüvel
  2. python-rsa

Commits

Barry Mead  committed 8016789

Removed unnecessary prime qualification per RSA website

  • Participants
  • Parent commits 563d0d0
  • Branches default

Comments (0)

Files changed (1)

File rsa/__init__.py

View file
     """Returns a tuple of two different primes of nbits bits"""
     pbits = nbits + (nbits/16)  #Make sure that p and q aren't too close
     qbits = nbits - (nbits/16)  #or the factoring programs can factor n
+    p = getprime(pbits)
     while True:
-        p = getprime(pbits)
         q = getprime(qbits)
-        phi_n = (p-1)*(q-1)
-        #Make sure p and q are different and phi_n is not divisible by 256
-        if not (q == p or phi_n & 255 == 0): break
+        #Make sure p and q are different.
+        if not q == p: break
     return (p, q)
 
 def extended_gcd(a, b):