Fixed #2444 -- added an __hash__ to x509 Names
diff --git a/src/cryptography/x509/name.py b/src/cryptography/x509/name.py
index 992786e..9d93ece 100644
--- a/src/cryptography/x509/name.py
+++ b/src/cryptography/x509/name.py
@@ -40,6 +40,9 @@
     def __ne__(self, other):
         return not self == other
 
+    def __hash__(self):
+        return hash((self.oid, self.value))
+
     def __repr__(self):
         return "<NameAttribute(oid={0.oid}, value={0.value!r})>".format(self)
 
@@ -60,6 +63,11 @@
     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)
 
diff --git a/tests/test_x509.py b/tests/test_x509.py
index cb05daf..e7de2ef 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -2755,6 +2755,23 @@
         assert name1 != name2
         assert name1 != object()
 
+    def test_hah(self):
+        name1 = x509.Name([
+            x509.NameAttribute(x509.ObjectIdentifier('oid'), u'value1'),
+            x509.NameAttribute(x509.ObjectIdentifier('oid2'), u'value2'),
+        ])
+        name2 = x509.Name([
+            x509.NameAttribute(x509.ObjectIdentifier('oid'), u'value1'),
+            x509.NameAttribute(x509.ObjectIdentifier('oid2'), u'value2'),
+        ])
+        name3 = x509.Name([
+            x509.NameAttribute(x509.ObjectIdentifier('oid2'), u'value2'),
+            x509.NameAttribute(x509.ObjectIdentifier('oid'), u'value1'),
+        ])
+
+        assert hash(name1) == hash(name2)
+        assert hash(name1) != hash(name3)
+
     def test_repr(self):
         name = x509.Name([
             x509.NameAttribute(NameOID.COMMON_NAME, u'cryptography.io'),