From d710735d1f2ff0ab586af9f871aa6e226e50be9b Mon Sep 17 00:00:00 2001 From: Leonid Evdokimov Date: Fri, 27 Sep 2024 14:17:13 +0300 Subject: [PATCH] blake3_c: unity *_test() function signature and Verification value --- Hashes.h | 6 +++--- main.cpp | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Hashes.h b/Hashes.h index cd21c6ca..d1631d75 100644 --- a/Hashes.h +++ b/Hashes.h @@ -1156,14 +1156,14 @@ void farsh256_test ( const void * key, int len, unsigned seed, void * out ); extern "C" { #include "blake3/blake3_impl.h" // The C API, serially - inline void blake3c_test ( const void * key, int len, unsigned seed, void * out ) + inline void blake3c_test ( const void * key, int len, uint32_t seed, void * out ) { blake3_hasher hasher; #if 1 blake3_hasher_init (&hasher); // See GH #168 - hasher.key[0] ^= (uint32_t)seed; - hasher.chunk.cv[0] ^= (uint32_t)seed; + hasher.key[0] ^= seed; + hasher.chunk.cv[0] ^= seed; #else // same speed uint32_t seed_key[8] = {0x6A09E667 ^ (uint32_t)seed, 0xBB67AE85, 0x3C6EF372, diff --git a/main.cpp b/main.cpp index 2484d085..485303bf 100644 --- a/main.cpp +++ b/main.cpp @@ -148,12 +148,9 @@ HashInfo g_hashes[] = { edonr224, 224, 0x83A8E7AB, "edonr224", "EDON-R 224", GOOD, {} }, { edonr256, 256, 0x06DD4F96, "edonr256", "EDON-R 256", GOOD, {} }, #endif -#if defined(HAVE_BIT32) && !defined(_WIN32) -# define BLAKE3_VERIF 0x58571F56 -#else -# define BLAKE3_VERIF 0x50E4CD91 -#endif -{ blake3c_test, 256, BLAKE3_VERIF, "blake3_c", "BLAKE3 c", GOOD, {0x6a09e667} }, +// There are certain 32-bit non-Windows machines producing 0x58571F56 as verification value for blake3_c. +// That deserves further investigation. +{ blake3c_test, 256, 0x50E4CD91, "blake3_c", "BLAKE3 c", GOOD, {0x6a09e667} }, #if defined(HAVE_BLAKE3) { blake3_test, 256, 0x0, "blake3", "BLAKE3 Rust", GOOD, {} }, { blake3_64, 64, 0x0, "blake3_64", "BLAKE3 Rust, low 64 bits", GOOD, {} },