2 comments

  • Charon7726 minutes ago
    &gt; Like addition<p>I&#x27;m perplexed to the claim that addition is cheaper than XOR, especially since addition is built upon XOR, am I missing anything? Is it javascript specific?
  • bryanrasmussen1 hour ago
    a hash function that produce hashes that are already in the hash table should, IMO, not be called a hash function.<p>I get why technically it is a hash function, but still, no.
    • baruch1 minute ago
      It is mathematically impossible for a proper hash function (one with an output range smaller than its input range) to not have collisions. The proof uses the Pigeon Hole Principle <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Pigeonhole_principle" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Pigeonhole_principle</a>
    • ahazred8ta53 minutes ago
      A perfect hash function <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Perfect_hash_function" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Perfect_hash_function</a> has to be specially constructed for each desired set of inputs. Generic hash functions cannot be &#x27;perfect&#x27;.
    • phinnaeus1 hour ago
      Here is a hash function that does not have hash collisions:<p><pre><code> fn hash(data): return data</code></pre>
      • Charon7727 minutes ago
        Well it no longer constrains the data in a fixed output length.