summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Mead <barrymead@cox.net>2010-02-19 17:11:10 -0700
committerBarry Mead <barrymead@cox.net>2010-02-19 17:11:10 -0700
commit19d4f7efc047f5e83aa6a05b11e1e38eb7badd59 (patch)
treeb2cfa161a4d8a5ff922d65fbbf3f16118e744e05
parent390a107ea17899197316c445344e861fc9dfd383 (diff)
downloadrsa-git-19d4f7efc047f5e83aa6a05b11e1e38eb7badd59.tar.gz
Removed unnecessary prime qualification per RSA website
-rw-r--r--rsa/__init__.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/rsa/__init__.py b/rsa/__init__.py
index de29ec9..d7fddd5 100644
--- a/rsa/__init__.py
+++ b/rsa/__init__.py
@@ -314,12 +314,11 @@ def find_p_q(nbits):
"""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):