I am not sure if I am using murmur3
(OpenHFT's zero-allocation-hashing) function correctly but the result seems different for hashChars()
and hashBytes()
// Using zero-allocation-hashing 0.16
String input = "abc123";
System.out.println(LongHashFunction.murmur_3().hashChars(input));
System.out.println(LongHashFunction.murmur_3().hashBytes(input.getBytes(StandardCharsets.UTF_8)));
Output:
-4878457159164508227
-7432123028918728600
The latter one produces the same output as Guava lib.
Which function should be used for String
inputs?
Shouldn't both functions produce the same result?
Update:
How can I get same output as :
Hashing.murmur3_128().newHasher().putString(input, Charsets.UTF_8).hash().asLong();
Hashing.murmur3_128().newHasher().putString(input, Charsets.UTF_8).hash().toString()
using zero-allocation-hashing
lib which seems to be faster than Guava