Skip to content

Commit

Permalink
add gxhash32 results
Browse files Browse the repository at this point in the history
only a few bad seeds.
  • Loading branch information
rurban committed Dec 15, 2024
1 parent e41184b commit b2ad5ae
Show file tree
Hide file tree
Showing 12 changed files with 893 additions and 22 deletions.
25 changes: 23 additions & 2 deletions Hashes.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,17 +350,38 @@ inline void xxHash32_test( const void * key, int len, uint32_t seed, void * out
// objsize 10-104 + 3e0-5ce: 738
*(uint32_t*)out = (uint32_t) XXH32(key, (size_t) len, (unsigned) seed);
}
// objsize 4183e0 - 4186c0: 736
inline void gxhash32_test( const void * key, int len, uint32_t seed, void * out ) {
*(uint32_t*)out = gxhash32((uint8_t*)key, (size_t) len, seed);
}
#ifdef HAVE_INT64
inline void xxHash64_test( const void * key, int len, uint32_t seed, void * out ) {
// objsize 630-7fc + c10-1213: 1999
*(uint64_t*)out = (uint64_t) XXH64(key, (size_t) len, (unsigned long long) seed);
}
// objsize 418110 - 4183e0: 720
inline void gxhash64_test( const void * key, int len, uint32_t seed, void * out ) {
// objsize 630-7fc + c10-1213: 1999
*(uint64_t*)out = (uint64_t) gxhash64((uint8_t*)key, (size_t) len, seed);
*(uint64_t*)out = gxhash64((uint8_t*)key, (size_t) len, seed);
}
#endif

static inline bool gxhash32_bad_seeds(std::vector<uint64_t> &seeds)
{
seeds = std::vector<uint64_t>{ UINT64_C (
0xe1c1ec7d, 0x0376a937, , 0x64ef3cc9, 0x282c25a4, 0xab1d407e, 0xef794206,
0x90626a1e, 0x9c0731c3, 0x3c1daeaa, 0xbd359253) };
return true;
}
void gxhash32_seed_init(size_t &seed)
{
// reject bad seeds
const std::vector<uint64_t> bad_seeds = { UINT64_C (
0xe1c1ec7d, 0x0376a937, , 0x64ef3cc9, 0x282c25a4, 0xab1d407e, 0xef794206,
0x90626a1e, 0x9c0731c3, 0x3c1daeaa, 0xbd359253) };
while (std::find(bad_seeds.begin(), bad_seeds.end(), (uint64_t)seed) != bad_seeds.end())
seed++;
}

#define restrict // oddly enough, seems to choke on this keyword
#include "xxh3.h"

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ SMhasher
| [k-hashv64](doc/k-hashv64.txt) | 9251.05 | 51.72 | 251.83 (2) |1279 | |
| [komihash](doc/komihash.txt) | 12179.74 | 33.23 | 224.80 (2) |1323 | |
| [polymur](doc/polymur.txt) | 9913.53 | 41.68 | 232.56 (3) |1128 | |
| [gxhash64](doc/gxhash64.txt) | 48919.73 | 36.61 | 236.98 (3) | | AES only |
| [gxhash32](doc/gxhash32.txt) | 47943.08 | 37.71 | 251.38 (2) |736 | AES only |
| [gxhash64](doc/gxhash64.txt) | 48919.73 | 36.61 | 236.98 (3) |720 | AES only |

The sortable table variants:

Expand Down
12 changes: 10 additions & 2 deletions doc/air.html
Original file line number Diff line number Diff line change
Expand Up @@ -1744,12 +1744,20 @@ <h1 id="smhasher">SMhasher</h1>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash32.txt">gxhash32</a></td>
<td align="right"></td>
<td align="right"></td>
<td align="right"></td>
<td align="right">736</td>
<td align="left">AES only</td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash64.txt">gxhash64</a></td>
<td align="right">1017.15</td>
<td align="right">178.25</td>
<td align="right">313.64 (9)</td>
<td align="right"></td>
<td align="left"></td>
<td align="right">720</td>
<td align="left">AES only</td>
</tr>
</tbody>
</table>
Expand Down
12 changes: 10 additions & 2 deletions doc/epyc.html
Original file line number Diff line number Diff line change
Expand Up @@ -1824,12 +1824,20 @@ <h1 id="smhasher">SMhasher</h1>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash32.txt">gxhash32</a></td>
<td align="right"></td>
<td align="right"></td>
<td align="right"></td>
<td align="right">736</td>
<td align="left">AES only</td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash64.txt">gxhash64</a></td>
<td align="right">103530.08</td>
<td align="right">27.00</td>
<td align="right">147.16 (1)</td>
<td align="right"></td>
<td align="left"></td>
<td align="right">720</td>
<td align="left">AES only</td>
</tr>
</tbody>
</table>
Expand Down
772 changes: 772 additions & 0 deletions doc/gxhash32.txt

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions doc/i686.html
Original file line number Diff line number Diff line change
Expand Up @@ -1664,12 +1664,20 @@ <h1 id="smhasher">SMhasher</h1>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash32.txt">gxhash32</a></td>
<td align="right">44875.37</td>
<td align="right">43.49</td>
<td align="right">218.40 (4)</td>
<td align="right">736</td>
<td align="left">AES only</td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash64.txt">gxhash64</a></td>
<td align="right">46810.04</td>
<td align="right">43.86</td>
<td align="right">204.13 (2)</td>
<td align="right"></td>
<td align="left"></td>
<td align="right">720</td>
<td align="left">AES only</td>
</tr>
</tbody>
</table>
Expand Down
12 changes: 10 additions & 2 deletions doc/i7.html
Original file line number Diff line number Diff line change
Expand Up @@ -1824,12 +1824,20 @@ <h1 id="smhasher">SMhasher</h1>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash32.txt">gxhash32</a></td>
<td align="right">45444.84</td>
<td align="right">29.21</td>
<td align="right">146.50 (2)</td>
<td align="right">736</td>
<td align="left">AES only</td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash64.txt">gxhash64</a></td>
<td align="right">45409.33</td>
<td align="right">29.21</td>
<td align="right">145.25 (3)</td>
<td align="right"></td>
<td align="left"></td>
<td align="right">720</td>
<td align="left">AES only</td>
</tr>
</tbody>
</table>
Expand Down
12 changes: 10 additions & 2 deletions doc/intel.html
Original file line number Diff line number Diff line change
Expand Up @@ -1752,12 +1752,20 @@ <h1 id="smhasher">SMhasher</h1>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash32.txt">gxhash32</a></td>
<td align="right"></td>
<td align="right"></td>
<td align="right"></td>
<td align="right">730</td>
<td align="left">AES only</td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash64.txt">gxhash64</a></td>
<td align="right">1017.15</td>
<td align="right">178.25</td>
<td align="right">313.64 (9)</td>
<td align="right"></td>
<td align="left"></td>
<td align="right">720</td>
<td align="left">AES only</td>
</tr>
</tbody>
</table>
Expand Down
16 changes: 12 additions & 4 deletions doc/phone.html
Original file line number Diff line number Diff line change
Expand Up @@ -1622,12 +1622,20 @@ <h1 id="smhasher">SMhasher</h1>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash32.txt">gxhash32</a></td>
<td align="right"></td>
<td align="right"></td>
<td align="right"></td>
<td align="right"></td>
<td align="left">AES only</td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash64.txt">gxhash64</a></td>
<td align="right">1017.15</td>
<td align="right">178.25</td>
<td align="right">313.64 (9)</td>
<td align="right"></td>
<td align="left"></td>
<td align="right"></td>
<td align="right"></td>
<td align="right"></td>
<td align="left">AES only</td>
</tr>
</tbody>
</table>
Expand Down
12 changes: 10 additions & 2 deletions doc/ryzen3.html
Original file line number Diff line number Diff line change
Expand Up @@ -1824,12 +1824,20 @@ <h1 id="smhasher">SMhasher</h1>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash32.txt">gxhash32</a></td>
<td align="right"></td>
<td align="right"></td>
<td align="right"></td>
<td align="right">736</td>
<td align="left">AES only</td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash64.txt">gxhash64</a></td>
<td align="right">1017.15</td>
<td align="right">178.25</td>
<td align="right">313.64 (9)</td>
<td align="right"></td>
<td align="left"></td>
<td align="right">720</td>
<td align="left">AES only</td>
</tr>
</tbody>
</table>
Expand Down
12 changes: 10 additions & 2 deletions doc/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -1824,12 +1824,20 @@ <h1 id="smhasher">SMhasher</h1>
<td align="left"></td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash32.txt">gxhash32</a></td>
<td align="right">47943.08</td>
<td align="right">37.71</td>
<td align="right">251.38 (2)</td>
<td align="right">736</td>
<td align="left">AES only</td>
</tr>
<tr class="good">
<td align="left"><a href="gxhash64.txt">gxhash64</a></td>
<td align="right">48919.73</td>
<td align="right">36.61</td>
<td align="right">236.98 (3)</td>
<td align="right"></td>
<td align="left"></td>
<td align="right">720</td>
<td align="left">AES only</td>
</tr>
</tbody>
</table>
Expand Down
15 changes: 14 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,10 +691,15 @@ HashInfo g_hashes[] =
#ifdef HAVE_AESNI
// FIXME
#if defined __linux && defined GITHUB_ACTIONS
#define GX32_VFY 0x2D5674B0
#define GX_VFY 0x87FA3129
#else
#define GX32_VFY 0xEC19D715
#define GX_VFY 0x9189E456
#endif
{ gxhash32_test, 32, 0xEC19D715, "gxhash32", "gxHash, 32-bit, AES-only", GOOD,
{0xe1c1ec7d, 0x0376a937, , 0x64ef3cc9, 0x282c25a4, 0xab1d407e, 0xef794206,
0x90626a1e, 0x9c0731c3, 0x3c1daeaa, 0xbd359253} },
{ gxhash64_test, 64, GX_VFY, "gxhash64", "gxHash, 64-bit, AES-only, unportable", GOOD, {} },
#endif
{ xxHash64_test, 64, 0x024B7CF4, "xxHash64", "xxHash, 64-bit", GOOD, {} },
Expand Down Expand Up @@ -912,6 +917,10 @@ void Bad_Seed_init (pfHash hash, uint32_t &seed) {
(hash == poly_3_mersenne && seed == 0x3d25f745))
seed++;
#endif
#ifdef HAVE_AESNI
else if(hash == gxhash32_test)
gxhash32_seed_init(seed);
#endif
#if defined(HAVE_SSE42) && defined(__x86_64__)
else if (hash == clhash_test && seed == 0x0)
seed++;
Expand Down Expand Up @@ -951,6 +960,10 @@ bool Hash_Seed_init (pfHash hash, size_t seed) {
hashx_seed_init(info, seed);
*/
#endif
#ifdef HAVE_AESNI
else if(hash == gxhash32_test)
gxhash32_seed_init(seed);
#endif
#ifdef HAVE_UMASH
else if (hash == umash32 || hash == umash32_hi || hash == umash || hash == umash128)
umash_seed_init(seed);
Expand All @@ -962,7 +975,7 @@ bool Hash_Seed_init (pfHash hash, size_t seed) {
else if(hash == polymur_test)
polymur_seed_init(seed);
else
return false;
return false;
return true;
}

Expand Down

0 comments on commit b2ad5ae

Please sign in to comment.