A 128-bit hash function.
Instances are immutable. Therefore, it is safe to use a single instance across multiple threads and for multiple hash calculations.
Implementations must ensure that
hashTo128Bits(T, com.dynatrace.hash4j.hashing.HashFunnel<T>)(obj, funnel).getAsLong() == Hasher64.hashToLong(T, com.dynatrace.hash4j.hashing.HashFunnel<T>)(obj,
funnel)
-
Method Summary
Modifier and TypeMethodDescriptionintThe size of the hash value in bits.hashBytesTo128Bits(byte[] input) Hashes a byte array to a 128-bitHashValue128value.hashBytesTo128Bits(byte[] input, int off, int len) Hashes a byte array to a 128-bitHashValue128value.hashCharsTo128Bits(CharSequence input) Hashes aCharSequenceto a 128-bitHashValue128value.<T> HashValue128hashTo128Bits(T obj, HashFunnel<T> funnel) Hashes an object to a 128-bitHashValue128value.Methods inherited from interface com.dynatrace.hash4j.hashing.Hasher32
hashBytesToInt, hashBytesToInt, hashCharsToInt, hashIntIntIntToInt, hashIntLongToInt, hashLongIntToInt, hashLongLongLongToInt, hashLongLongToInt, hashToIntMethods inherited from interface com.dynatrace.hash4j.hashing.Hasher64
hashBytesToLong, hashBytesToLong, hashCharsToLong, hashIntIntIntToLong, hashIntLongToLong, hashLongIntToLong, hashLongLongLongToLong, hashLongLongToLong, hashToLong
-
Method Details
-
hashStream
HashStream128 hashStream()- Specified by:
hashStreamin interfaceHasher32- Specified by:
hashStreamin interfaceHasher64
-
hashTo128Bits
Hashes an object to a 128-bitHashValue128value.- Type Parameters:
T- the type- Parameters:
obj- the objectfunnel- the funnel- Returns:
- the hash value
-
hashBytesTo128Bits
Hashes a byte array to a 128-bitHashValue128value.Equivalent to
hashBytesTo128Bits(input, 0, input.length).- Parameters:
input- the byte array- Returns:
- the hash value
-
hashBytesTo128Bits
Hashes a byte array to a 128-bitHashValue128value.Equivalent to
hashTo128Bits(input, (b, f) -> f.putBytes(b, off, len)).- Parameters:
input- the byte arrayoff- the offsetlen- the length- Returns:
- the hash value
-
hashCharsTo128Bits
Hashes aCharSequenceto a 128-bitHashValue128value.Equivalent to
hashTo128Bits(input, (c, f) -> f.putChars(c)).- Parameters:
input- the char sequence- Returns:
- the hash value
-
getHashBitSize
int getHashBitSize()The size of the hash value in bits.- Returns:
- the size of the hash value in bits
-