diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2016-04-30 18:57:15 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-04-30 17:57:15 -0500 |
commit | c16de483685b0d5afa77bd88bd4a561b09e899b1 (patch) | |
tree | 8294e8389f6ef9d1f010005d47cca89e8800055d /src | |
parent | 988df9ba0326f5adc84ee6ca51607674737f1469 (diff) | |
download | cryptography-c16de483685b0d5afa77bd88bd4a561b09e899b1.tar.gz cryptography-c16de483685b0d5afa77bd88bd4a561b09e899b1.tar.bz2 cryptography-c16de483685b0d5afa77bd88bd4a561b09e899b1.zip |
Fixed #2887 -- implement __hash__ on EC numbers classes (#2888)
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/ec.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/primitives/asymmetric/ec.py b/src/cryptography/hazmat/primitives/asymmetric/ec.py index eda7df0c..907a6358 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/ec.py +++ b/src/cryptography/hazmat/primitives/asymmetric/ec.py @@ -302,6 +302,9 @@ class EllipticCurvePublicNumbers(object): def __ne__(self, other): return not self == other + def __hash__(self): + return hash((self.x, self.y, self.curve.name, self.curve.key_size)) + def __repr__(self): return ( "<EllipticCurvePublicNumbers(curve={0.curve.name}, x={0.x}, " @@ -341,6 +344,9 @@ class EllipticCurvePrivateNumbers(object): def __ne__(self, other): return not self == other + def __hash__(self): + return hash((self.private_value, self.public_numbers)) + class ECDH(object): pass |