It's not just a random mush of xors and shifts, it's:
- Add the next character value to the current value;
- Left-shift the current value by 4 (because most of the entropy in plain text ASCII is in the lower 4 bits);
- XOR the top 4 bits into the bottom four bits of the current value, because they're going to get shifted out next time; then clear the top four bits.
It's still not a great hash function (obviously). Part of the issue is that with a 32-bit unsigned int it's effectively only a 28 bit hash.
It's not just a random mush of xors and shifts, it's:
It's still not a great hash function (obviously). Part of the issue is that with a 32-bit unsigned int it's effectively only a 28 bit hash.