From 9442fa9afab67146c02a994463186b7c09908f77 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 24 Oct 2015 18:32:10 -0400 Subject: Fixed #2444 -- added an __hash__ to x509 Names --- src/cryptography/x509/name.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/cryptography/x509/name.py b/src/cryptography/x509/name.py index 992786ef..9d93ece1 100644 --- a/src/cryptography/x509/name.py +++ b/src/cryptography/x509/name.py @@ -40,6 +40,9 @@ class NameAttribute(object): def __ne__(self, other): return not self == other + def __hash__(self): + return hash((self.oid, self.value)) + def __repr__(self): return "".format(self) @@ -60,6 +63,11 @@ class Name(object): def __ne__(self, other): return not self == other + def __hash__(self): + # TODO: this is relatively expensive, if this looks like a bottleneck + # for you, consider optimizing! + return hash(tuple(self._attributes)) + def __iter__(self): return iter(self._attributes) -- cgit v1.2.3