diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-01-18 10:02:53 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-01-18 10:02:53 -0600 |
commit | aca05e6c7d7efff451c3f149d0e9e12d34a63a9f (patch) | |
tree | d51943fcbda6863847fe41bfff4fe1e4c920da6c /src | |
parent | 836b830b155c1b04fbad40ab76f0de4339d8628c (diff) | |
download | cryptography-aca05e6c7d7efff451c3f149d0e9e12d34a63a9f.tar.gz cryptography-aca05e6c7d7efff451c3f149d0e9e12d34a63a9f.tar.bz2 cryptography-aca05e6c7d7efff451c3f149d0e9e12d34a63a9f.zip |
various improvements to rsa_recover_prime_factors per review feedback
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/rsa.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cryptography/hazmat/primitives/asymmetric/rsa.py b/src/cryptography/hazmat/primitives/asymmetric/rsa.py index 15aba3e4..d267c387 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/rsa.py +++ b/src/cryptography/hazmat/primitives/asymmetric/rsa.py @@ -138,7 +138,7 @@ def rsa_recover_prime_factors(n, e, d): # any candidate a leads to successful factoring. # See "Digitalized Signatures and Public Key Functions as Intractable # as Factorization", M. Rabin, 1979 - spotted = 0 + spotted = False a = 2 while not spotted and a < 1000: k = t @@ -150,11 +150,11 @@ def rsa_recover_prime_factors(n, e, d): # We have found a number such that (cand-1)(cand+1)=0 (mod n). # Either of the terms divides n. p = gcd(cand + 1, n) - spotted = 1 + spotted = True break - k = k * 2 + k *= 2 # This value was not any good... let's try another! - a = a + 2 + a += 2 if not spotted: raise ValueError("Unable to compute factors p and q from exponent d.") # Found ! |