This commit is contained in:
Dmitri Bogomolov 2021-07-29 22:18:16 +03:00
parent ba2d0e2687
commit 15039cea94
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 11 additions and 0 deletions

View File

@ -2,6 +2,11 @@
from binascii import unhexlify from binascii import unhexlify
# hello, page 1 of the Specification
sample_double_sha512 = unhexlify(
'0592a10584ffabf96539f3d780d776828c67da1ab5b169e9e8aed838aaecc9ed36d49ff14'
'23c55f019e050c66c6324f53588be88894fef4dcffdb74b98e2b200')
magic = 0xE9BEB4D9 magic = 0xE9BEB4D9

View File

@ -16,6 +16,7 @@ except ImportError:
RIPEMD = None RIPEMD = None
from .samples import ( from .samples import (
sample_double_sha512,
sample_msg, sample_pubsigningkey, sample_pubencryptionkey, sample_msg, sample_pubsigningkey, sample_pubencryptionkey,
sample_privsigningkey, sample_privencryptionkey, sample_ripe, sample_privsigningkey, sample_privencryptionkey, sample_ripe,
sample_sig, sample_sig_sha1 sample_sig, sample_sig_sha1
@ -68,6 +69,11 @@ class TestHighlevelcrypto(unittest.TestCase):
# self.assertEqual( # self.assertEqual(
# highlevelcrypto.sign(sample_msg, sample_privsigningkey), sample_sig) # 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): def test_verify(self):
"""Verify sample signatures and newly generated ones""" """Verify sample signatures and newly generated ones"""
pubkey_hex = hexlify(sample_pubsigningkey) pubkey_hex = hexlify(sample_pubsigningkey)