diff options
author | Josh Snyder <josh.snyder@robinhood.com> | 2021-10-14 18:29:37 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2021-11-28 20:24:17 -0500 |
commit | 2c574ea29456726177eece3d8f740182ea34f0b4 (patch) | |
tree | 8da9da8ddc7bb958e35a9601f51e9ab6a63d77ea /paramiko/ecdsakey.py | |
parent | 0344146de514ab1f2643bad5bfce0a92d4dcf1ee (diff) | |
download | paramiko-2c574ea29456726177eece3d8f740182ea34f0b4.tar.gz |
Check all data on keys when comparing for equality
This eliminates the possibility that a hash collision results in two PKey
objects that == each other.
Diffstat (limited to 'paramiko/ecdsakey.py')
-rw-r--r-- | paramiko/ecdsakey.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/paramiko/ecdsakey.py b/paramiko/ecdsakey.py index 3d3d09be..a59017f5 100644 --- a/paramiko/ecdsakey.py +++ b/paramiko/ecdsakey.py @@ -194,14 +194,13 @@ class ECDSAKey(PKey): def __str__(self): return self.asbytes() - def __hash__(self): - return hash( - ( - self.get_name(), - self.verifying_key.public_numbers().x, - self.verifying_key.public_numbers().y, - ) - ) + @property + def _fields(self): + return ( + 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 |