Package org.greenrobot.essentials.hash
Class Murmur3F
- java.lang.Object
-
- org.greenrobot.essentials.hash.Murmur3F
-
- All Implemented Interfaces:
java.util.zip.Checksum
,Checksum128
public class Murmur3F extends java.lang.Object implements Checksum128
Murmur3F (MurmurHash3_x64_128)
-
-
Field Summary
Fields Modifier and Type Field Description private static long
C1
private static long
C2
private boolean
finished
private long
finishedH1
private long
finishedH2
private long
h1
private long
h2
private int
length
private long
partialK1
private long
partialK2
private int
partialPos
private static PrimitiveArrayUtils
primitiveArrayUtils
private long
seed
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
applyKs(long k1, long k2)
private void
checkFinished()
private long
fmix64(long k)
private java.lang.String
getPaddedHexString(long value)
long
getValue()
java.math.BigInteger
getValueBigInteger()
Positive value.byte[]
getValueBytesBigEndian()
Big endian is the default in Java / network byte order.byte[]
getValueBytesLittleEndian()
Big endian is used by most machines natively.java.lang.String
getValueHexString()
Padded with leading 0s to ensure length of 32.long
getValueHigh()
Returns the higher 64 bits of the 128 bit hash.void
reset()
void
update(byte[] b)
void
update(byte[] b, int off, int len)
void
update(int b)
void
updateLongBE(long value)
ConsiderupdateLongLE(long)
for better performance if you do not rely on big endian (BE) byte order.void
updateLongLE(long value)
Special update method to hash long values very efficiently using Java's native little endian (LE) byte order.
-
-
-
Field Detail
-
primitiveArrayUtils
private static PrimitiveArrayUtils primitiveArrayUtils
-
C1
private static final long C1
- See Also:
- Constant Field Values
-
C2
private static final long C2
- See Also:
- Constant Field Values
-
seed
private final long seed
-
h1
private long h1
-
h2
private long h2
-
length
private int length
-
partialPos
private int partialPos
-
partialK1
private long partialK1
-
partialK2
private long partialK2
-
finished
private boolean finished
-
finishedH1
private long finishedH1
-
finishedH2
private long finishedH2
-
-
Method Detail
-
update
public void update(int b)
- Specified by:
update
in interfacejava.util.zip.Checksum
-
updateLongLE
public void updateLongLE(long value)
Special update method to hash long values very efficiently using Java's native little endian (LE) byte order. Note, that you cannot mix this with other (previous) hash updates, because it only supports 8-bytes alignment.
-
updateLongBE
public void updateLongBE(long value)
ConsiderupdateLongLE(long)
for better performance if you do not rely on big endian (BE) byte order.
-
update
public void update(byte[] b)
- Specified by:
update
in interfacejava.util.zip.Checksum
-
update
public void update(byte[] b, int off, int len)
- Specified by:
update
in interfacejava.util.zip.Checksum
-
applyKs
private void applyKs(long k1, long k2)
-
checkFinished
private void checkFinished()
-
fmix64
private long fmix64(long k)
-
getValue
public long getValue()
- Specified by:
getValue
in interfacejava.util.zip.Checksum
-
getValueHigh
public long getValueHigh()
Returns the higher 64 bits of the 128 bit hash.- Specified by:
getValueHigh
in interfaceChecksum128
-
getValueBigInteger
public java.math.BigInteger getValueBigInteger()
Positive value.- Specified by:
getValueBigInteger
in interfaceChecksum128
-
getValueHexString
public java.lang.String getValueHexString()
Padded with leading 0s to ensure length of 32.- Specified by:
getValueHexString
in interfaceChecksum128
-
getPaddedHexString
private java.lang.String getPaddedHexString(long value)
-
getValueBytesBigEndian
public byte[] getValueBytesBigEndian()
Description copied from interface:Checksum128
Big endian is the default in Java / network byte order.- Specified by:
getValueBytesBigEndian
in interfaceChecksum128
-
getValueBytesLittleEndian
public byte[] getValueBytesLittleEndian()
Description copied from interface:Checksum128
Big endian is used by most machines natively.- Specified by:
getValueBytesLittleEndian
in interfaceChecksum128
-
reset
public void reset()
- Specified by:
reset
in interfacejava.util.zip.Checksum
-
-