diff --git a/src/tests/samples.py b/src/tests/samples.py index 57510c3f..8efae597 100644 --- a/src/tests/samples.py +++ b/src/tests/samples.py @@ -2,6 +2,11 @@ from binascii import unhexlify +# hello, page 1 of the Specification +sample_double_sha512 = unhexlify( + '0592a10584ffabf96539f3d780d776828c67da1ab5b169e9e8aed838aaecc9ed36d49ff14' + '23c55f019e050c66c6324f53588be88894fef4dcffdb74b98e2b200') + magic = 0xE9BEB4D9 diff --git a/src/tests/test_crypto.py b/src/tests/test_crypto.py index e5bb600a..3563098d 100644 --- a/src/tests/test_crypto.py +++ b/src/tests/test_crypto.py @@ -16,6 +16,7 @@ except ImportError: RIPEMD = None from .samples import ( + sample_double_sha512, sample_msg, sample_pubsigningkey, sample_pubencryptionkey, sample_privsigningkey, sample_privencryptionkey, sample_ripe, sample_sig, sample_sig_sha1 @@ -68,6 +69,11 @@ class TestHighlevelcrypto(unittest.TestCase): # self.assertEqual( # highlevelcrypto.sign(sample_msg, sample_privsigningkey), sample_sig) + def test_double_sha512(self): + """Reproduce the example on page 1 of the Specification""" + self.assertEqual( + highlevelcrypto.double_sha512(b'hello'), sample_double_sha512) + def test_verify(self): """Verify sample signatures and newly generated ones""" pubkey_hex = hexlify(sample_pubsigningkey)