diff --git a/tests/crypto/test_crypto.py b/tests/crypto/test_crypto.py index 342873b6a..a8dff7a38 100644 --- a/tests/crypto/test_crypto.py +++ b/tests/crypto/test_crypto.py @@ -1,5 +1,6 @@ import unittest import random +import sha3 from nacl.utils import EncryptedMessage from npre import umbral from npre import elliptic_curve as ec @@ -42,6 +43,23 @@ class TestCrypto(unittest.TestCase): self.assertNotIn(2, output) self.assertIn(1, output) + def test_keccak_digest(self): + data = b'this is a test' + + digest1 = sha3.keccak_256(data).digest() + digest2 = Crypto.keccak_digest(data) + + self.assertEqual(digest1, digest2) + + # Test iterables + data = data.split() + + digest1 = sha3.keccak_256(b''.join(data)).digest() + digest2 = Crypto.keccak_digest(*data) + + self.assertEqual(digest1, digest2) + + def test_symm_encrypt(self): key = random._urandom(32) plaintext = b'this is a test'