Package io.debezium.util
Class MurmurHash3
java.lang.Object
io.debezium.util.MurmurHash3
Taken from Infinispan code base.
Removed irrelevant and unused parts like Externalizer or 128 bits hashes
and format the code to match Debezium checkstyle rules.
MurmurHash3 implementation in Java, based on Austin Appleby's original in C
Only implementing x64 version, because this should always be faster on 64 bit
native processors, even 64 bit being ran with a 32 bit OS; this should also
be as fast or faster than the x86 version on some modern 32 bit processors.
- Author:
- Patrick McFarland
- See Also:
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
addByte
(MurmurHash3.State state, byte b, int len) (package private) static void
bmix
(MurmurHash3.State state) boolean
(package private) static long
fmix
(long k) (package private) static long
getblock
(byte[] key, int i) static MurmurHash3
int
hash
(byte[] payload) int
hash
(int hashcode) static int
hash
(long[] payload) Hashes a byte array efficiently.int
int
hashCode()
private int
hashString
(String s) static int
MurmurHash3_x64_32
(byte[] key, int seed) Hash a value using the x64 32 bit variant of MurmurHash3static int
MurmurHash3_x64_32
(long[] key, int seed) Hash a value using the x64 32 bit variant of MurmurHash3static long
MurmurHash3_x64_64
(byte[] key, int seed) Hash a value using the x64 64 bit variant of MurmurHash3static long
MurmurHash3_x64_64
(long[] key, int seed) Hash a value using the x64 64 bit variant of MurmurHash3private long
MurmurHash3_x64_64_String
(String s, long seed) toString()
-
Field Details
-
instance
-
INVALID_CHAR
public static final byte INVALID_CHAR- See Also:
-
-
Constructor Details
-
MurmurHash3
private MurmurHash3()
-
-
Method Details
-
getInstance
-
getblock
static long getblock(byte[] key, int i) -
bmix
-
fmix
static long fmix(long k) -
MurmurHash3_x64_64
public static long MurmurHash3_x64_64(byte[] key, int seed) Hash a value using the x64 64 bit variant of MurmurHash3- Parameters:
key
- value to hashseed
- random value- Returns:
- 64 bit hashed key
-
MurmurHash3_x64_32
public static int MurmurHash3_x64_32(byte[] key, int seed) Hash a value using the x64 32 bit variant of MurmurHash3- Parameters:
key
- value to hashseed
- random value- Returns:
- 32 bit hashed key
-
MurmurHash3_x64_64
public static long MurmurHash3_x64_64(long[] key, int seed) Hash a value using the x64 64 bit variant of MurmurHash3- Parameters:
key
- value to hashseed
- random value- Returns:
- 64 bit hashed key
-
MurmurHash3_x64_32
public static int MurmurHash3_x64_32(long[] key, int seed) Hash a value using the x64 32 bit variant of MurmurHash3- Parameters:
key
- value to hashseed
- random value- Returns:
- 32 bit hashed key
-
hash
public int hash(byte[] payload) -
hash
public static int hash(long[] payload) Hashes a byte array efficiently.- Parameters:
payload
- a byte array to hash- Returns:
- a hash code for the byte array
-
hash
public int hash(int hashcode) -
hash
-
hashString
-
MurmurHash3_x64_64_String
-
addByte
-
equals
-
hashCode
public int hashCode() -
toString
-