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 | 1d9f41ccdf1db7acc6570c991788ec260f87e296 (patch) | |
tree | c1c54deb05c2fb7e2748736dabc7d340eabceb2d | |
parent | f2fec9090cc4220e12b9b6f3102114bcc6aa9575 (diff) | |
download | rsa-git-1d9f41ccdf1db7acc6570c991788ec260f87e296.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 |