See the link in karmakaze's answer. It shows a spinning shift in much more accurate code and discusses common details (and problems) with various main hashes.
Overflow is not bad. Just put the module back in :-) Consider a simple shift with XOR and feed the overflow back into the stream?
Consider the value of i for each element, where h is long:
h ^= i; // XOR in new data
h <<= 11; // shift with a relatively long cycle
h ^= (h >>> 32); // feed the "overflow" back into the input
h &= 0xFFFF; // throw out "overflow"
Happy coding.
user166390
source
share