- All Superinterfaces:
Hasher32
- All Known Subinterfaces:
Hasher128
Instances are immutable. Therefore, it is safe to use a single instance across multiple threads and for multiple hash calculations.
Implementations must ensure that
(int)hashToLong(T, com.dynatrace.hash4j.hashing.HashFunnel<T>)(obj, funnel) == Hasher32.hashToInt(T, com.dynatrace.hash4j.hashing.HashFunnel<T>)(obj,
funnel)
-
Method Summary
Modifier and TypeMethodDescriptionintThe size of the hash value in bits.longhashBytesToLong(byte[] input) Hashes a byte array to a 64-bitlongvalue.longhashBytesToLong(byte[] input, int off, int len) Hashes a byte array to a 64-bitlongvalue.<T> longhashBytesToLong(T input, long off, long len, ByteAccess<T> access) Hashes a sequence of bytes to a 64-bitlongvaluelonghashCharsToLong(CharSequence input) Hashes aCharSequenceto a 64-bitlongvalue.longhashIntIntIntToLong(int v1, int v2, int v3) Hashes/Mixes three 32-bitintvalues into a 64-bitlongvalue.longhashIntIntToLong(int v1, int v2) Hashes/Mixes two 32-bitintvalues into a 64-bitlongvalue.longhashIntLongToLong(int v1, long v2) Hashes/Mixes a 32-bitintvalue and a 64-bitlongvalue into a 64-bitlongvalue.longhashIntToLong(int v) Hashes a 32-bitintvalue into a 64-bitlongvalue.longhashLongIntToLong(long v1, int v2) Hashes/Mixes a 64-bitlongvalue and a 32-bitintvalue into a 64-bitlongvalue.longhashLongLongLongToLong(long v1, long v2, long v3) Hashes/Mixes three 64-bitlongvalues into a 64-bitlongvalue.longhashLongLongToLong(long v1, long v2) Hashes/Mixes two 64-bitlongvalues into a 64-bitlongvalue.longhashLongToLong(long v) Hashes a 64-bitlongvalue into a 64-bitlongvalue.Starts a hash stream.hashStreamFromState(byte[] state) Reconstructs a hash stream from a given state.<T> longhashToLong(T obj, HashFunnel<T> funnel) Hashes an object to a 64-bitlongvalue.Methods inherited from interface com.dynatrace.hash4j.hashing.Hasher32
hashBytesToInt, hashBytesToInt, hashBytesToInt, hashCharsToInt, hashIntIntIntToInt, hashIntIntToInt, hashIntLongToInt, hashIntToInt, hashLongIntToInt, hashLongLongLongToInt, hashLongLongToInt, hashLongToInt, hashToInt
-
Method Details
-
hashStream
HashStream64 hashStream()Starts a hash stream.- Specified by:
hashStreamin interfaceHasher32- Returns:
- a new
HashStream64instance
-
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.
- Specified by:
hashStreamFromStatein interfaceHasher32- Returns:
- a new
HashStream64instance
-
hashToLong
Hashes an object to a 64-bitlongvalue.- Type Parameters:
T- the type- Parameters:
obj- the objectfunnel- the funnel- Returns:
- the hash value
-
hashBytesToLong
long hashBytesToLong(byte[] input) Hashes a byte array to a 64-bitlongvalue.Equivalent to
hashBytesToLong(input, 0, input.length).- Parameters:
input- the byte array- Returns:
- the hash value
-
hashBytesToLong
long hashBytesToLong(byte[] input, int off, int len) Hashes a byte array to a 64-bitlongvalue.Equivalent to
hashToLong(input, (b, f) -> f.putBytes(b, off, len)).- Parameters:
input- the byte arrayoff- the offsetlen- the length- Returns:
- the hash value
-
hashBytesToLong
Hashes a sequence of bytes to a 64-bitlongvalue- 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
-
hashCharsToLong
Hashes aCharSequenceto a 64-bitlongvalue.Equivalent to
hashToLong(input, (c, f) -> f.putChars(c)).- Parameters:
input- the char sequence- Returns:
- the hash value
-
hashIntToLong
long hashIntToLong(int v) Hashes a 32-bitintvalue into a 64-bitlongvalue.Equivalent to
hashStream().putInt(v).getAsInt();- Parameters:
v- value- Returns:
- the hash value
-
hashIntIntToLong
long hashIntIntToLong(int v1, int v2) Hashes/Mixes two 32-bitintvalues into a 64-bitlongvalue.Equivalent to
hashStream().putInt(v1).putInt(v2).getAsInt();- Parameters:
v1- first valuev2- second value- Returns:
- the hash value
-
hashIntIntIntToLong
long hashIntIntIntToLong(int v1, int v2, int v3) Hashes/Mixes three 32-bitintvalues into a 64-bitlongvalue.Equivalent to
hashStream().putInt(v1).putInt(v2).putInt(v3).getAsLong();- Parameters:
v1- first valuev2- second valuev3- third value- Returns:
- the hash value
-
hashIntLongToLong
long hashIntLongToLong(int v1, long v2) Hashes/Mixes a 32-bitintvalue and a 64-bitlongvalue into a 64-bitlongvalue.Equivalent to
hashStream().putInt(v1).putLong(v2).getAsLong();- Parameters:
v1- first valuev2- second value- Returns:
- the hash value
-
hashLongToLong
long hashLongToLong(long v) Hashes a 64-bitlongvalue into a 64-bitlongvalue.Equivalent to
hashStream().putLong(v).getAsInt();- Parameters:
v- value- Returns:
- the hash value
-
hashLongLongToLong
long hashLongLongToLong(long v1, long v2) Hashes/Mixes two 64-bitlongvalues into a 64-bitlongvalue.Equivalent to
hashStream().putLong(v1).putLong(v2).getAsLong();- Parameters:
v1- first valuev2- second value- Returns:
- the hash value
-
hashLongLongLongToLong
long hashLongLongLongToLong(long v1, long v2, long v3) Hashes/Mixes three 64-bitlongvalues into a 64-bitlongvalue.Equivalent to
hashStream().putLong(v1).putLong(v2).putLong(v3).getAsLong();- Parameters:
v1- first valuev2- second valuev3- third value- Returns:
- the hash value
-
hashLongIntToLong
long hashLongIntToLong(long v1, int v2) Hashes/Mixes a 64-bitlongvalue and a 32-bitintvalue into a 64-bitlongvalue.Equivalent to
hashStream().putLong(v1).putInt(v2).getAsLong();- 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
-