std::unordered_map

Pages: 12
note that a great deal of effort has been put into generating hash functions (consider, sha as a prime example) that generate radically different results for similar keys (eg if you hashed off some words like bob, rob, fob, job, and lob). There are online sha hash you can see what I mean. Doing those in some simple way that generates similar output for similar input leads to bad collisions in a lot of real data, where it does tend to have patterns (eg addresses, where you have 2 million of them in the same city, or people names, or some kinds of numeric data).
eg
rob = 84313ef39b0a979f0608491608870b3f2065f447d73e4373ba75ae2330aa82b5
fob = 133b82c4f4f41646b29771b181dbb72f00e1b6a56e614f159e8cc4956983e04f
granted the results are big values, but the point is the difference in similar input, which you can do while making a more normal sized int value using the same ideas.
https://xorbin.com/tools/sha256-hash-calculator
there are several string based ones that do this kind of thing to ensure good distribution in general.
its a bit of work, compared to just a % operation, of course.
Last edited on
Topic archived. No new replies allowed.
Pages: 12