From 33f0763a0b4ec7e73dc7c9877c29c83dec05d157 Mon Sep 17 00:00:00 2001 From: Leonid Evdokimov Date: Thu, 26 Sep 2024 17:18:03 +0300 Subject: [PATCH] NMHASH32: WIP-N+1 --- Hashes.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Hashes.cpp b/Hashes.cpp index c3559370..2f62865d 100644 --- a/Hashes.cpp +++ b/Hashes.cpp @@ -1302,6 +1302,28 @@ void nmhash32_test ( const void * key, int len, uint32_t seed, void * out ) { printf("NMHASH32_long(rand_str, %u, 42) = %x\n", count, x); uint32_t oh; + memcpy(accX, &rand_str[11], sizeof(accX)); + memcpy(accY, &rand_str[23], sizeof(accY)); + + for (unsigned i = 0; i < COUNT_OF(accX); i++) + printf("0: %4d %08x\n", i, accX[i]); + const size_t nbGroups = sizeof(NMH_ACC_INIT) / sizeof(*NMH_ACC_INIT); + size_t i; + for (i = 0; i < nbGroups; ++i) { + accX[i] ^= accX[i] << 5 ^ accX[i] >> 13; // ?? + } + for (unsigned i = 0; i < COUNT_OF(accX); i++) + printf("1: %4d %08x\n", i, accX[i]); + for (i = 0; i < nbGroups; ++i) { + accX[i] ^= accX[i] << 11 ^ accX[i] >> 9; // ??? + } + for (unsigned i = 0; i < COUNT_OF(accX); i++) + printf("2: %4d %08x\n", i, accX[i]); + for (i = 0; i < nbGroups; ++i) { + accX[i] ^= accX[i] >> 10 ^ accX[i] >> 20; // ??? + } + for (unsigned i = 0; i < COUNT_OF(accX); i++) + printf("3: %4d %08x\n", i, accX[i]); sumhash32(accX, sizeof(accX), 0, &oh); printf("sumhash32(accX) = %x\n", oh); sumhash32(accY, sizeof(accY), 0, &oh); printf("sumhash32(accY) = %x\n", oh); NMHASH32_long_round(accX, accY, reinterpret_cast(rand_str));