The purpose of a hash function ist to retrieve a unique value for a given sequence (of bytes, characters, …).
Therefore you need the length of the sequence, here with ‘strlen’.
Without bit shift operator (<<) you would get the same result for the sequence ‘abc’ and ‘cba’.
The xor operator (^) ‘scrambles”https://stackoverflow.com/”hashes’ the current value further, so it becomes more unlikley, that similar sequences results in an equivalent value (imagine sequences with a certain pattern, like ‘abcabc…’).
1
solved I don’t understand this hash-function code