Instances are immutable. Therefore, it is safe to use a single instance across multiple threads and for multiple hash calculations.
-
Method Summary
Modifier and TypeMethodDescriptionintThe size of the hash value in bits.inthashBytesToInt(byte[] input) Hashes a byte array to a 32-bit integer value.inthashBytesToInt(byte[] input, int off, int len) Hashes a byte array to a 32-bit integer value.<T> inthashBytesToInt(T input, long off, long len, ByteAccess<T> access) Hashes a sequence of bytes to a 32-bitintvalueinthashCharsToInt(CharSequence input) Hashes aCharSequenceto a 32-bitintvalue.inthashIntIntIntToInt(int v1, int v2, int v3) Hashes/Mixes three 32-bitintvalues into a 32-bitintvalue.inthashIntIntToInt(int v1, int v2) Hashes/Mixes two 32-bitintvalues into a 32-bitintvalue.inthashIntLongToInt(int v1, long v2) Hashes/Mixes a 32-bitintvalue and a 64-bitlongvalue into a 32-bitintvalue.inthashIntToInt(int v) Hashes a 32-bitintvalue into a 32-bitintvalue.inthashLongIntToInt(long v1, int v2) Hashes/Mixes a 64-bitlongvalue and a 32-bitintvalue into a 32-bitintvalue.inthashLongLongLongToInt(long v1, long v2, long v3) Hashes/Mixes three 64-bitlongvalues into a 32-bitintvalue.inthashLongLongToInt(long v1, long v2) Hashes/Mixes two 64-bitlongvalues into a 32-bitintvalue.inthashLongToInt(long v) Hashes a 64-bitlongvalue into a 32-bitintvalue.Starts a hash stream.hashStreamFromState(byte[] state) Reconstructs a hash stream from a given state.<T> inthashToInt(T obj, HashFunnel<T> funnel) Hashes an object to a 32-bit integer value.
-
Method Details
-
hashStream
HashStream32 hashStream()Starts a hash stream.- Returns:
- a new
HashStream32instance
-
hashStreamFromState
Reconstructs a hash stream from a given state.The behavior is undefined, if the given state was not created by a hash stream of a hasher that is equal to this hasher.
- Returns:
- a new
HashStream32instance
-
hashToInt
Hashes an object to a 32-bit integer value.- Type Parameters:
T- the type- Parameters:
obj- the objectfunnel- the funnel- Returns:
- the hash value
-
hashBytesToInt
int hashBytesToInt(byte[] input) Hashes a byte array to a 32-bit integer value.Equivalent to
hashBytesToInt(input, 0, input.length).- Parameters:
input- the byte array- Returns:
- the hash value
-
hashBytesToInt
int hashBytesToInt(byte[] input, int off, int len) Hashes a byte array to a 32-bit integer value.Equivalent to
hashToInt(input, (b, f) -> f.putBytes(b, off, len)).- Parameters:
input- the byte arrayoff- the offsetlen- the length- Returns:
- the hash value
-
hashBytesToInt
Hashes a sequence of bytes to a 32-bitintvalue- Type Parameters:
T- the type of the input- Parameters:
input- the inputoff- the offsetlen- the lengthaccess- a strategy to access the bytes of the input- Returns:
- the hash value
-
hashCharsToInt
Hashes aCharSequenceto a 32-bitintvalue.Equivalent to
hashToInt(input, (c, f) -> f.putChars(c)).- Parameters:
input- the char sequence- Returns:
- the hash value
-
hashIntToInt
int hashIntToInt(int v) Hashes a 32-bitintvalue into a 32-bitintvalue.Equivalent to
hashStream().putInt(v).getAsInt();- Parameters:
v- value- Returns:
- the hash value
-
hashIntIntToInt
int hashIntIntToInt(int v1, int v2) Hashes/Mixes two 32-bitintvalues into a 32-bitintvalue.Equivalent to
hashStream().putInt(v1).putInt(v2).getAsInt();- Parameters:
v1- first valuev2- second value- Returns:
- the hash value
-
hashIntIntIntToInt
int hashIntIntIntToInt(int v1, int v2, int v3) Hashes/Mixes three 32-bitintvalues into a 32-bitintvalue.Equivalent to
hashStream().putInt(v1).putInt(v2).putInt(v3).getAsInt();- Parameters:
v1- first valuev2- second valuev3- third value- Returns:
- the hash value
-
hashIntLongToInt
int hashIntLongToInt(int v1, long v2) Hashes/Mixes a 32-bitintvalue and a 64-bitlongvalue into a 32-bitintvalue.Equivalent to
hashStream().putInt(v1).putLong(v2).getAsInt();- Parameters:
v1- first valuev2- second value- Returns:
- the hash value
-
hashLongToInt
int hashLongToInt(long v) Hashes a 64-bitlongvalue into a 32-bitintvalue.Equivalent to
hashStream().putLong(v).getAsInt();- Parameters:
v- value- Returns:
- the hash value
-
hashLongLongToInt
int hashLongLongToInt(long v1, long v2) Hashes/Mixes two 64-bitlongvalues into a 32-bitintvalue.Equivalent to
hashStream().putLong(v1).putLong(v2).getAsInt();- Parameters:
v1- first valuev2- second value- Returns:
- the hash value
-
hashLongLongLongToInt
int hashLongLongLongToInt(long v1, long v2, long v3) Hashes/Mixes three 64-bitlongvalues into a 32-bitintvalue.Equivalent to
hashStream().putLong(v1).putLong(v2).putLong(v3).getAsInt();- Parameters:
v1- first valuev2- second valuev3- third value- Returns:
- the hash value
-
hashLongIntToInt
int hashLongIntToInt(long v1, int v2) Hashes/Mixes a 64-bitlongvalue and a 32-bitintvalue into a 32-bitintvalue.Equivalent to
hashStream().putLong(v1).putInt(v2).getAsInt();- Parameters:
v1- first valuev2- second value- Returns:
- the hash value
-
getHashBitSize
int getHashBitSize()The size of the hash value in bits.- Returns:
- the size of the hash value in bits
-