summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--paramiko/dsskey.py8
-rw-r--r--paramiko/ecdsakey.py6
-rw-r--r--paramiko/rsakey.py6
3 files changed, 5 insertions, 15 deletions
diff --git a/paramiko/dsskey.py b/paramiko/dsskey.py
index 4644e9a6..3b0f09d3 100644
--- a/paramiko/dsskey.py
+++ b/paramiko/dsskey.py
@@ -82,13 +82,7 @@ class DSSKey(PKey):
return self.asbytes()
def __hash__(self):
- h = hash(self.get_name())
- h = h * 37 + hash(self.p)
- h = h * 37 + hash(self.q)
- h = h * 37 + hash(self.g)
- h = h * 37 + hash(self.y)
- # h might be a long by now...
- return hash(h)
+ return hash((self.get_name(), self.p, self.q, self.g, self.y))
def get_name(self):
return 'ssh-dss'
diff --git a/paramiko/ecdsakey.py b/paramiko/ecdsakey.py
index e4f74310..cb5d77b8 100644
--- a/paramiko/ecdsakey.py
+++ b/paramiko/ecdsakey.py
@@ -165,10 +165,8 @@ class ECDSAKey(PKey):
return self.asbytes()
def __hash__(self):
- h = hash(self.get_name())
- h = h * 37 + hash(self.verifying_key.public_numbers().x)
- h = h * 37 + hash(self.verifying_key.public_numbers().y)
- return hash(h)
+ return hash((self.get_name(), self.verifying_key.public_numbers().x,
+ self.verifying_key.public_numbers().y))
def get_name(self):
return self.ecdsa_curve.key_format_identifier
diff --git a/paramiko/rsakey.py b/paramiko/rsakey.py
index fa2b4c44..8ad6d6e4 100644
--- a/paramiko/rsakey.py
+++ b/paramiko/rsakey.py
@@ -89,10 +89,8 @@ class RSAKey(PKey):
return self.asbytes().decode('utf8', errors='ignore')
def __hash__(self):
- h = hash(self.get_name())
- h = h * 37 + hash(self.public_numbers.e)
- h = h * 37 + hash(self.public_numbers.n)
- return hash(h)
+ return hash((self.get_name(), self.public_numbers.e,
+ self.public_numbers.n))
def get_name(self):
return 'ssh-rsa'