summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2019-08-04 17:43:55 +0200
committerSybren A. Stüvel <sybren@stuvel.eu>2019-08-04 17:47:26 +0200
commit3c5ee594a2e38b27f086d042d9d2b9d7d0d0269d (patch)
treeb8caf816400742d66a547c21cfef950a6c3b3d9f /tests
parentb68f6181e9729afc6cae42cdf12b6a8dba52a80e (diff)
downloadrsa-git-3c5ee594a2e38b27f086d042d9d2b9d7d0d0269d.tar.gz
Add support for SHA3 hashing
This is based on https://github.com/sybrenstuvel/python-rsa/pull/96, with a few improvements: - The minimum of one use of SHA3 in a unit test, to at least touch it at some point. - Documented the support of SHA3. - Only install the third-party library required by Python 3.5 when we're running on Python 3.5. Newer Python versions support SHA3 natively.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pkcs1.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/test_pkcs1.py b/tests/test_pkcs1.py
index 1704ffd..1f0d305 100644
--- a/tests/test_pkcs1.py
+++ b/tests/test_pkcs1.py
@@ -75,9 +75,11 @@ class SignatureTest(unittest.TestCase):
message = b'je moeder'
signature = pkcs1.sign(message, self.priv, 'SHA-256')
-
self.assertEqual('SHA-256', pkcs1.verify(message, signature, self.pub))
+ signature = pkcs1.sign(message, self.priv, 'SHA3-256')
+ self.assertEqual('SHA3-256', pkcs1.verify(message, signature, self.pub))
+
def test_find_signature_hash(self):
"""Test happy flow of sign and find_signature_hash"""