• The2b ( The2b@lemmy.vg ) 
    link
    fedilink
    English
    arrow-up
    7
    ·
    1 year ago

    This is valid on a single unlisted assumption: The hash function has equal distribution. If your has function ends by multipliying the has value by 4, for example, your number of possible boxes is 1/4th the otherwise expected value based on the size of the hash output

    • TehPers ( TehPers@beehaw.org ) 
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 year ago

      The distribution is super important here too. Hashing any value to zero (or h(x) = 0) is valid, but a terrible distribution. The challenge is getting real-world values hashed in a mostly uniform distribution to avoid collisions where possible.

      Still, the contents of the article are useful even outside of hashing. It should just disclaim that the width of the output isn’t the only thing important in a hash function.

      • The2b ( The2b@lemmy.vg ) 
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        The hashes not being there isn’t particularly relevant within a hash function outputting a specific size. If your hash function is always 64 bits for example, the fact that you have 3/4th of them not exist means you should be operating as if its a 16 bit hash, not a 64 bit hash. If you still do this math based on the 64 bits outputted (2^64 boxes) you’d arrive at very inaccurate numbers.