summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2016-03-29 20:39:08 +0200
committerSybren A. Stüvel <sybren@stuvel.eu>2016-03-29 20:39:08 +0200
commit96eaa5e82b75b8cfc36a67ad72a768f03c285647 (patch)
tree7196a466524ccfaa2ad3eaaa901db6cd6ed9222c /tests
parent5e08c91a122bac2e59e176928aa1b24f9aa7b0b2 (diff)
downloadrsa-git-96eaa5e82b75b8cfc36a67ad72a768f03c285647.tar.gz
Implemented __hash__ function for key objects.
Overriding __eq__ blocks inheritance of __hash__ in Python 3. Fixes issue #55
Diffstat (limited to 'tests')
-rw-r--r--tests/test_key.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_key.py b/tests/test_key.py
index 833a6aa..afefa3a 100644
--- a/tests/test_key.py
+++ b/tests/test_key.py
@@ -59,3 +59,14 @@ class KeyGenTest(unittest.TestCase):
exponent=exponent)
self.assertEqual(39317, p)
self.assertEqual(33107, q)
+
+
+class HashTest(unittest.TestCase):
+ """Test hashing of keys"""
+
+ def test_hash_possible(self):
+ priv, pub = rsa.key.newkeys(16)
+
+ # This raises a TypeError when hashing isn't possible.
+ hash(priv)
+ hash(pub)