summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Mead <barrymead@cox.net>2010-02-19 21:06:24 -0700
committerBarry Mead <barrymead@cox.net>2010-02-19 21:06:24 -0700
commitc915b229531e2dac19101504806994ace12846e3 (patch)
treee225eb828dd4b0c1cdfc34943bfec4d2fe05243c
parent92f8c7eab8fd581dbfd3d8cf190cae71ac9ba59b (diff)
downloadrsa-c915b229531e2dac19101504806994ace12846e3.tar.gz
Removed unnecessary qualification of p and q per RSA web site.
-rw-r--r--rsa/fastrsa.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/rsa/fastrsa.py b/rsa/fastrsa.py
index 7f19d34..f1bd87a 100644
--- a/rsa/fastrsa.py
+++ b/rsa/fastrsa.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):