remove our blake2b_128/256 tests

as we're just calling python stdlib there,
we can assume that they have tests for it.
This commit is contained in:
Thomas Waldmann 2022-03-05 21:47:40 +01:00
parent 2566671d85
commit 07159342ba

View File

@ -1,7 +1,7 @@
from binascii import hexlify, unhexlify
from ..crypto.low_level import AES256_CTR_HMAC_SHA256, AES256_OCB, CHACHA20_POLY1305, UNENCRYPTED, \
IntegrityError, blake2b_128, blake2b_256, is_libressl
IntegrityError, is_libressl
from ..crypto.low_level import bytes_to_long, bytes_to_int, long_to_bytes
from ..crypto.low_level import hkdf_hmac_sha512
@ -177,28 +177,6 @@ class CryptoTestCase(BaseTestCase):
self.assert_raises(IntegrityError,
lambda: cs.decrypt(hdr_mac_iv_cdata_corrupted))
def test_blake2b_256(self):
# In BLAKE2 the output length actually is part of the hashes personality - it is *not* simple truncation like in
# the SHA-2 family. Therefore we need to generate test vectors ourselves (as is true for most applications that
# are not precisely vanilla BLAKE2b-512 or BLAKE2s-256).
#
# Obtained via "b2sum" utility from the official BLAKE2 repository. It calculates the exact hash of a file's
# contents, no extras (like length) included.
assert blake2b_256(b'', b'abc') == unhexlify('bddd813c634239723171ef3fee98579b94964e3bb1cb3e427262c8c068d52319')
assert blake2b_256(b'a', b'bc') == unhexlify('bddd813c634239723171ef3fee98579b94964e3bb1cb3e427262c8c068d52319')
assert blake2b_256(b'ab', b'c') == unhexlify('bddd813c634239723171ef3fee98579b94964e3bb1cb3e427262c8c068d52319')
assert blake2b_256(b'abc', b'') == unhexlify('bddd813c634239723171ef3fee98579b94964e3bb1cb3e427262c8c068d52319')
key = unhexlify('e944973af2256d4d670c12dd75304c319f58f4e40df6fb18ef996cb47e063676')
data = memoryview(b'1234567890' * 100)
assert blake2b_256(key, data) == unhexlify('97ede832378531dd0f4c668685d166e797da27b47d8cd441e885b60abd5e0cb2')
def test_blake2b_128(self):
# (see above)
assert blake2b_128(b'') == unhexlify('cae66941d9efbd404e4d88758ea67670')
assert blake2b_128(b'abc') == unhexlify('cf4ab791c62b8d2b2109c90275287816')
assert blake2b_128(b'abcd'*8) == unhexlify('0f759d9a32d3f99250c1781a8baa58b9')
# These test vectors come from https://www.kullo.net/blog/hkdf-sha-512-test-vectors/
# who claims to have verified these against independent Python and C++ implementations.