diff options
author | Barry Mead <barrymead@cox.net> | 2010-02-16 20:25:36 -0700 |
---|---|---|
committer | Barry Mead <barrymead@cox.net> | 2010-02-16 20:25:36 -0700 |
commit | e8317fec0f11d1275ddc6fb0b4fed1bb108a1bdf (patch) | |
tree | c1c54deb05c2fb7e2748736dabc7d340eabceb2d | |
parent | 8117bb18d7919bbbfe83bdf7c40badeeea181e0b (diff) | |
download | rsa-e8317fec0f11d1275ddc6fb0b4fed1bb108a1bdf.tar.gz |
Better description of extended_gcd changes in comments
-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 |