diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2016-01-27 18:29:43 +0100 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2016-01-27 18:29:43 +0100 |
commit | 282069092d41c67fbda10cb5ffa06a58cd9c5baf (patch) | |
tree | 33e8acb3d09346b35340f7bdfb9795281292913a /rsa/prime.py | |
parent | d9dbf6e1bf84466363b90a8c0928149841b70f67 (diff) | |
download | rsa-git-282069092d41c67fbda10cb5ffa06a58cd9c5baf.tar.gz |
Fixed PEP8 style issues
Diffstat (limited to 'rsa/prime.py')
-rw-r--r-- | rsa/prime.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/rsa/prime.py b/rsa/prime.py index 4763d16..2ac1ffe 100644 --- a/rsa/prime.py +++ b/rsa/prime.py @@ -20,10 +20,10 @@ Implementation based on the book Algorithm Design by Michael T. Goodrich and Roberto Tamassia, 2002. """ -__all__ = ['getprime', 'are_relatively_prime'] - import rsa.randnum +__all__ = ['getprime', 'are_relatively_prime'] + def gcd(p, q): """Returns the greatest common divisor of p and q @@ -47,7 +47,8 @@ def jacobi(a, b): assert a > 0 assert b > 0 - if a == 0: return 0 + if a == 0: + return 0 result = 1 while a > 1: if a & 1: @@ -58,7 +59,8 @@ def jacobi(a, b): if (((b * b) - 1) >> 3) & 1: result = -result a >>= 1 - if a == 0: return 0 + if a == 0: + return 0 return result @@ -69,7 +71,8 @@ def jacobi_witness(x, n): f = pow(x, n >> 1, n) - if j == f: return False + if j == f: + return False return True @@ -93,7 +96,8 @@ def randomized_primality_testing(n, k): for _ in range(k): x = rsa.randnum.randint(n - 1) - if jacobi_witness(x, n): return False + if jacobi_witness(x, n): + return False return True |