Skip to content

Commit

Permalink
blake3_c: unity *_test() function signature and Verification value
Browse files Browse the repository at this point in the history
  • Loading branch information
darkk authored and rurban committed Sep 28, 2024
1 parent 5a4db55 commit 1d85820
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Hashes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 3 additions & 6 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,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, {} },
Expand Down

0 comments on commit 1d85820

Please sign in to comment.