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).
Asked
Active
Viewed 51 times
0
-
1Wouldn't the best algorithm depend on your anticipated distribution? – Dave Newton Oct 02 '17 at 20:20
-
I guess so, but that information is normally not available during static introspection of my languages of interest. – Nordlöw Oct 02 '17 at 20:22
-
Why the close vote? – Nordlöw Oct 02 '17 at 20:33
-
1But 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 Oct 02 '17 at 20:40
-
1I 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. – Dave Newton Oct 02 '17 at 20:48