The test for double SHA512
This commit is contained in:
parent
3ed84a5863
commit
7348568c78
|
@ -2,6 +2,12 @@
|
|||
|
||||
from binascii import unhexlify
|
||||
|
||||
# hello, page 1 of the Specification
|
||||
sample_hash_data = b'hello'
|
||||
sample_double_sha512 = unhexlify(
|
||||
'0592a10584ffabf96539f3d780d776828c67da1ab5b169e9e8aed838aaecc9ed36d49ff14'
|
||||
'23c55f019e050c66c6324f53588be88894fef4dcffdb74b98e2b200')
|
||||
|
||||
|
||||
# 500 identical peers:
|
||||
# 1626611891, 1, 1, 127.0.0.1, 8444
|
||||
|
|
|
@ -17,6 +17,7 @@ except ImportError:
|
|||
RIPEMD160 = None
|
||||
|
||||
from .samples import (
|
||||
sample_double_sha512, sample_hash_data,
|
||||
sample_msg, sample_pubsigningkey, sample_pubencryptionkey,
|
||||
sample_privsigningkey, sample_privencryptionkey, sample_ripe,
|
||||
sample_sig, sample_sig_sha1
|
||||
|
@ -66,6 +67,12 @@ class TestCrypto(RIPEMD160TestCase, unittest.TestCase):
|
|||
class TestHighlevelcrypto(unittest.TestCase):
|
||||
"""Test highlevelcrypto public functions"""
|
||||
|
||||
def test_double_sha512(self):
|
||||
"""Reproduce the example on page 1 of the Specification"""
|
||||
self.assertEqual(
|
||||
highlevelcrypto.double_sha512(sample_hash_data),
|
||||
sample_double_sha512)
|
||||
|
||||
def test_randomBytes(self):
|
||||
"""Dummy checks for random bytes"""
|
||||
for n in (8, 32, 64):
|
||||
|
|
Reference in New Issue
Block a user