diff options
author | Barry Mead <barrymead@cox.net> | 2010-02-19 21:06:24 -0700 |
---|---|---|
committer | Barry Mead <barrymead@cox.net> | 2010-02-19 21:06:24 -0700 |
commit | c915b229531e2dac19101504806994ace12846e3 (patch) | |
tree | e225eb828dd4b0c1cdfc34943bfec4d2fe05243c | |
parent | 92f8c7eab8fd581dbfd3d8cf190cae71ac9ba59b (diff) | |
download | rsa-c915b229531e2dac19101504806994ace12846e3.tar.gz |
Removed unnecessary qualification of p and q per RSA web site.
-rw-r--r-- | rsa/fastrsa.py | 7 |
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): |