RabinHashFunction hash(byte[]) broken
Brought to you by:
bmartins
In the method private long hash(byte[] A, int offset, int length, long ws) , one finds lines such as
^ (long) (A[s] << 56)
Unfortunately, this doesn't work correctly. The cast to (long) is not in the right place. I think you want the following instead.
^ ((long)A[s] << 56)
The problem is that the expression (A[s] << 56) is computed as an int (because A[s] is byte and 56 is an int). The original cast takes place after Java has already done the shift treating values as 32bit int.