diff options
author | Barry Mead <barrymead@cox.net> | 2010-02-16 20:26:23 -0700 |
---|---|---|
committer | Barry Mead <barrymead@cox.net> | 2010-02-16 20:26:23 -0700 |
commit | 04f696ee18c23a21c73ed369658fb4b433101c04 (patch) | |
tree | 041871c999ffed7f3b4397b613767cb746fd3959 | |
parent | e8317fec0f11d1275ddc6fb0b4fed1bb108a1bdf (diff) | |
download | rsa-04f696ee18c23a21c73ed369658fb4b433101c04.tar.gz |
Better help description of newkeys return values
-rw-r--r-- | rsa/fastrsa.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rsa/fastrsa.py b/rsa/fastrsa.py index 88b5163..7a1156c 100644 --- a/rsa/fastrsa.py +++ b/rsa/fastrsa.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 modulo b or a 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 negative wrap modulo original b + if (ly < 0): ly += oa #If negative wrap modulo original a return (a, lx, ly) # Main function: calculate encryption and decryption keys @@ -388,8 +388,8 @@ def newkeys(nbits): """Generates public and private keys, and returns them as (pub, priv). - The public key consists of a dict {e: ..., , n: ....). The private - key consists of a dict {d: ...., p: ...., q: ....). + The public key consists of a dict {e: ..., n: ...}. The private + key consists of a dict {p: ..., q: ..., dp: ..., dq: ..., qi: ...}. """ nbits = max(9,nbits) #Minimum key size is 9 bit for p and q (p, q, e, dp, dq, qi) = gen_keys(nbits) |