title: 64-bit multiplicative hashing
body: <p>I'm working on fast 64-bit hash. Many existing secure hash functions are too way slow, some non-cryptographic hash functions like FNV are just bad.</p>
  
  <p>Well, I came up with a FNV-like hash:</p>
  
  <pre><code>UINT64 hash=0;
  
  // for each input byte
  hash=(hash^(input_byte+1))*HASH_PRIME;
  </code></pre>
  
  <p>Main question is about <code>HASH_PRIME</code>. Often, we may see a <em>"golden ratio"</em> term for multiplicative hashing.
  For 64-bit hash, golden ratio is <code>0x9e3779b97f4a7c13</code>.</p>
  
  <p>I tested the 32-bit golden ratio for period in <code>PRNG</code>:</p>
  
  <pre><code>DWORD hash=0;
  // loop
  hash=(hash^1)*0x9e3779b9;
  rnd_out=hash&gt;&gt;24;
  </code></pre>
  
  <p>A good value here may produce the period of <code>0xFFFFFFFF</code> - i.e. max possible. This golden ratio produces notably smaller period.</p>
  
  <p>or just</p>
  
  <pre><code>DWORD hash=~0;
  // loop
  hash*=0x9e3779b9;
  rnd_out=hash&gt;&gt;24;
  </code></pre>
  
  <p>And again, a good enough multiplier can produce period of <code>0x3FFFFFFF</code> bytes. Golden ratio here produces again much shorter period.</p>
  
  <p>Never tested the 64-bit primes - too computationally expensive.</p>
  
  <p>Is period important for my hash? And where to find a good 64-bit <code>HASH_PRIMES</code> and how to test such stuff?</p>