Skip to content

Commit

Permalink
NMHASH32: WIP-N+1
Browse files Browse the repository at this point in the history
  • Loading branch information
darkk committed Sep 26, 2024
1 parent 45d326a commit 33f0763
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Hashes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const uint8_t*>(rand_str));
Expand Down

0 comments on commit 33f0763

Please sign in to comment.