diff options
-rw-r--r-- | rsa/__init__.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/rsa/__init__.py b/rsa/__init__.py index ad1e192..68f5953 100644 --- a/rsa/__init__.py +++ b/rsa/__init__.py @@ -330,15 +330,15 @@ def extended_gcd(a, b): y = 1 lx = 1 ly = 0 - la = a - lb = b #Remember modulus (to remove negs) + oa = a #Remember original a/b to remove + ob = b #negative values from return results while b != 0: q = long(a/b) (a, b) = (b, a % b) (x, lx) = ((lx - (q * x)),x) (y, ly) = ((ly - (q * y)),y) - if (lx < 0): lx += lb #No Negative return values - if (ly < 0): ly += la + if (lx < 0): lx += ob #If neg wrap modulo orignal b + if (ly < 0): ly += oa #If neg wrap modulo orignal a return (a, lx, ly) # Main function: calculate encryption and decryption keys |