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 | d4824bf7a6e336e85af64d3dee1029d417eaddd5 (patch) | |
| tree | e225eb828dd4b0c1cdfc34943bfec4d2fe05243c | |
| parent | 19d4f7efc047f5e83aa6a05b11e1e38eb7badd59 (diff) | |
| download | rsa-git-d4824bf7a6e336e85af64d3dee1029d417eaddd5.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): |
