summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Mead <barrymead@cox.net>2010-02-16 10:27:45 -0700
committerBarry Mead <barrymead@cox.net>2010-02-16 10:27:45 -0700
commit1c05563ae14ac204ac4f41dcde5fee1a840c03b3 (patch)
tree80d37e6678d39564bdcdd43b648d7eb97c176790
parent92bc157cdbffad45f164f73c9cf28436a6f2f363 (diff)
downloadrsa-1c05563ae14ac204ac4f41dcde5fee1a840c03b3.tar.gz
Shortened name of extended_euclid_gcd to extended_gcd so error messages would be short enough
-rw-r--r--rsa/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/rsa/__init__.py b/rsa/__init__.py
index 470dbf4..2469136 100644
--- a/rsa/__init__.py
+++ b/rsa/__init__.py
@@ -320,7 +320,7 @@ def find_p_q(nbits):
if not q == p: break
return (p, q)
-def extended_euclid_gcd(a, b):
+def extended_gcd(a, b):
"""Returns a tuple (d, i, j) such that d = gcd(a, b) = ia + jb
"""
# Iterateive Version is faster and uses much less stack space
@@ -351,11 +351,12 @@ def calculate_keys(p, q, nbits):
e = max(65537,getprime(nbits/4))
if are_relatively_prime(e, n) and are_relatively_prime(e, phi_n): break
- (d, i, j) = extended_euclid_gcd(e, phi_n)
+ (d, i, j) = extended_gcd(e, phi_n)
if not d == 1:
raise Exception("e (%d) and phi_n (%d) are not relatively prime" % (e, phi_n))
- if (i < 0): raise Exception("New gcd shouldn't return negative values")
+ if (i < 0):
+ raise Exception("New extended_gcd shouldn't return negative values")
if not (e * i) % phi_n == 1:
raise Exception("e (%d) and i (%d) are not mult. inv. modulo phi_n (%d)" % (e, i, phi_n))