Calculates a hash code for the specified token. @param token specified token @return hash code
(final byte[] token)
| 680 | * @return hash code |
| 681 | */ |
| 682 | public static int hashCode(final byte[] token) { |
| 683 | // warning: a change in the hash computation affects existing databases |
| 684 | final int tl = token.length, s = Math.max(1, tl / MAX_HASH_OPS); |
| 685 | int h = 0; |
| 686 | for(int t = 0; t < tl; t += s) { |
| 687 | h = h * 31 + token[t]; |
| 688 | } |
| 689 | return h; |
| 690 | } |
| 691 | |
| 692 | /** |
| 693 | * Compares two tokens for equality. |