0

I'm looking for information regarding fast non-cryptographic hash functions designed for small keys (1-32 bytes). I'm especially interested in the context of system languages such as C++, D, Rust where different hash-function could be defaulted by the library through static introspection depending on the key type. For instance if I want to instantiate a hash set or hash map with a 32-bit or 64-bit integer as key, which hash function should I pick for that case (when mapping a 64-bit value to an unsigned integer bucket index).

5
  • 1
    Wouldn't the best algorithm depend on your anticipated distribution? Commented Oct 2, 2017 at 20:20
  • I guess so, but that information is normally not available during static introspection of my languages of interest.
    – Nordlöw
    Commented Oct 2, 2017 at 20:22
  • Why the close vote?
    – Nordlöw
    Commented Oct 2, 2017 at 20:33
  • 1
    But you know that the C++ standard library already includes hashes for many basic types? (I ask this because if you don't have a special distribution I would assume the standard committee has already made good choices. My answer would be to use those.)
    – alain
    Commented Oct 2, 2017 at 20:40
  • 1
    I didn't vote to close, but without any more details, it seems like any standard algorithm would be fine. That's why I asked about anticipated distribution (which is language-neutral), e.g., what are you trying to hash--different types of data have different typical distributions. Commented Oct 2, 2017 at 20:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.