Skip to content

Commit

Permalink
TSip: make tsip_init() independent of global state
Browse files Browse the repository at this point in the history
  • Loading branch information
darkk authored and rurban committed Sep 28, 2024
1 parent de992ed commit 2e07153
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions Hashes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1150,10 +1150,8 @@ void halftime_hash_seed_init(size_t &seed)
static uint8_t tsip_key[16];
void tsip_init()
{
uint64_t r = rand_u64();
memcpy(&tsip_key[0], &r, 8);
r = rand_u64();
memcpy(&tsip_key[8], &r, 8);
Rand rng(UINT32_C(4044698852));
rng.rand_p(tsip_key, sizeof(tsip_key));
}
void tsip_test(const void *bytes, int len, uint32_t seed, void *out)
{
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ HashInfo g_hashes[] =
// as in rust and swift:
{ siphash13_test, 64, 0x29C010BF, "SipHash13", "SipHash 1-3 - SSSE3 optimized", GOOD, {} },
#ifndef _MSC_VER
{ tsip_test, 64, 0xF47B451B, "TSip", "Damian Gryski's Tiny SipHash variant", GOOD, {} },
{ tsip_test, 64, 0x5C2395A5, "TSip", "Damian Gryski's Tiny SipHash variant", GOOD, {} },
#ifdef HAVE_INT64
{ seahash_test, 64, 0xF0374078, "seahash", "seahash (64-bit, little-endian)", GOOD, {} },
{ seahash32low, 32, 0x712F0EE8, "seahash32low","seahash - lower 32bit", GOOD, {} },
Expand Down

0 comments on commit 2e07153

Please sign in to comment.