From 4905232eda39fda9f3b803d64f4ac6b3c3a8a530 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Wed, 19 Apr 2017 16:50:34 -0400 Subject: [PATCH] more tests. --- demos/hashsum.c | 12 ++++++++++++ src/hashes/blake2b.c | 10 ++++++++++ src/hashes/blake2s.c | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/demos/hashsum.c b/demos/hashsum.c index 8f94af5..9951a85 100644 --- a/demos/hashsum.c +++ b/demos/hashsum.c @@ -105,6 +105,18 @@ void register_algs(void) #ifdef LTC_WHIRLPOOL register_hash (&whirlpool_desc); #endif +#ifdef LTC_BLAKE2S + register_hash (&blake2s_128_desc); + register_hash (&blake2s_160_desc); + register_hash (&blake2s_224_desc); + register_hash (&blake2s_256_desc); +#endif +#ifdef LTC_BLAKE2B + register_hash (&blake2b_160_desc); + register_hash (&blake2b_256_desc); + register_hash (&blake2b_384_desc); + register_hash (&blake2b_512_desc); +#endif #ifdef LTC_CHC_HASH register_hash(&chc_desc); if ((err = chc_register(register_cipher(&aes_enc_desc))) != CRYPT_OK) { diff --git a/src/hashes/blake2b.c b/src/hashes/blake2b.c index 2d602ea..e41906a 100644 --- a/src/hashes/blake2b.c +++ b/src/hashes/blake2b.c @@ -508,6 +508,16 @@ int blake2b_256_test(void) 0x31, 0x71, 0xef, 0x3f, 0xee, 0x98, 0x57, 0x9b, 0x94, 0x96, 0x4e, 0x3b, 0xb1, 0xcb, 0x3e, 0x42, 0x72, 0x62, 0xc8, 0xc0, 0x68, 0xd5, 0x23, 0x19 } }, + { "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890", + { 0x0f, 0x6e, 0x01, 0x8d, 0x38, 0xd6, 0x3f, 0x08, + 0x4d, 0x58, 0xe3, 0x0c, 0x90, 0xfb, 0xa2, 0x41, + 0x5f, 0xca, 0x17, 0xfa, 0x66, 0x26, 0x49, 0xf3, + 0x8a, 0x30, 0x41, 0x7c, 0x57, 0xcd, 0xa8, 0x14 } }, { NULL, { 0 } } }; diff --git a/src/hashes/blake2s.c b/src/hashes/blake2s.c index a26b8ce..ec55206 100644 --- a/src/hashes/blake2s.c +++ b/src/hashes/blake2s.c @@ -400,6 +400,16 @@ int blake2s_256_test(void) 0xe1, 0xa7, 0x2b, 0xa3, 0x4e, 0xeb, 0x45, 0x2f, 0x37, 0x45, 0x8b, 0x20, 0x9e, 0xd6, 0x3a, 0x29, 0x4d, 0x99, 0x9b, 0x4c, 0x86, 0x67, 0x59, 0x82 } }, + { "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890", + { 0xa3, 0x78, 0x8b, 0x5b, 0x59, 0xee, 0xe4, 0x41, + 0x95, 0x23, 0x58, 0x00, 0xa4, 0xf9, 0xfa, 0x41, + 0x86, 0x0c, 0x7b, 0x1c, 0x35, 0xa2, 0x42, 0x70, + 0x50, 0x80, 0x79, 0x56, 0xe3, 0xbe, 0x31, 0x74 } }, { NULL, { 0 } } };