Skip to content

Commit

Permalink
Merge d69ef77 into 5061ee6
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscouzo committed Mar 22, 2017
2 parents 5061ee6 + d69ef77 commit 744601d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
8 changes: 1 addition & 7 deletions paramiko/dsskey.py
Expand Up @@ -82,13 +82,7 @@ def __str__(self):
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'
Expand Down
6 changes: 2 additions & 4 deletions paramiko/ecdsakey.py
Expand Up @@ -165,10 +165,8 @@ def __str__(self):
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
Expand Down
6 changes: 2 additions & 4 deletions paramiko/rsakey.py
Expand Up @@ -89,10 +89,8 @@ def __str__(self):
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'
Expand Down

0 comments on commit 744601d

Please sign in to comment.