mirror of
https://github.com/packwiz/packwiz-installer.git
synced 2025-04-19 21:16:30 +02:00
Fix Murmur2 hash implementation
This commit is contained in:
parent
c89d3b1e47
commit
432bb4e25f
@ -74,13 +74,13 @@ public class Murmur2Lib {
|
||||
int left = length - len_m;
|
||||
if (left != 0) {
|
||||
if (left >= 3) {
|
||||
h ^= (int) data[length - 3] << 16;
|
||||
h ^= (int) data[length - (left - 2)] << 16;
|
||||
}
|
||||
if (left >= 2) {
|
||||
h ^= (int) data[length - 2] << 8;
|
||||
h ^= (int) data[length - (left - 1)] << 8;
|
||||
}
|
||||
if (left >= 1) {
|
||||
h ^= (int) data[length - 1];
|
||||
h ^= data[length - left];
|
||||
}
|
||||
|
||||
h *= M_32;
|
||||
@ -152,7 +152,7 @@ public class Murmur2Lib {
|
||||
case 2:
|
||||
h ^= (long) (data[tailStart + 1] & 0xff) << 8;
|
||||
case 1:
|
||||
h ^= (long) (data[tailStart] & 0xff);
|
||||
h ^= data[tailStart] & 0xff;
|
||||
h *= M_64;
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,8 @@ class Murmur2Hasher : IHasher {
|
||||
val output = ByteArray(input.size)
|
||||
var index = 0
|
||||
for (b in input) {
|
||||
when (b.toInt()) {
|
||||
9, 10, 13, 32 -> {}
|
||||
when (b) {
|
||||
9.toByte(), 10.toByte(), 13.toByte(), 32.toByte() -> {}
|
||||
else -> {
|
||||
output[index] = b
|
||||
index++
|
||||
|
Loading…
x
Reference in New Issue
Block a user