4 ms·
You might need these, but often the most important quality in the hash function is that it is fast, because otherwise that is the slowest part of your loop, and
by ncmncm 5y ago
You might need these, but often the most important quality in the hash function is that it is fast, because otherwise that is the slowest part of your loop, and the randomness it adds doesn't help because the input has enough scatter already.
Almost all ISAs have a rotate instruction, which is just as fast as shift, but does not throw away any entropy. So, anywhere these use shifting, they would probably do at least as well with a rotate, and probably better.
Finally, you can probably get a hash that scatters as well as these but is substantially faster, maybe more than 2x, by arranging operations so that they can be computed in parallel by multiple "functional units" found in modern CPUs, and xoring the results together at the end. The functions presented build up what are called "dependency chains", where each expression depends on a previous result, so cannot be done in parallel.