java.lang.Object
com.dynatrace.hash4j.hashing.HashValues
Utility class for hash values.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]toByteArray(int hashValue) Returns the given hash value as byte array.static byte[]toByteArray(long hashValue) Returns the given hash value as byte array.static byte[]toByteArray(HashValue128 hashValue) Returns the given hash value as byte array.static StringtoHexString(int hashValue) Returns the hex-code representation of the hash value interpreted as numeric value.static StringtoHexString(long hashValue) Returns the hex-code representation of the hash value interpreted as numeric value.static StringtoHexString(HashValue128 hashValue) Returns the hex-code representation of the hash value interpreted as numeric value.
-
Method Details
-
toByteArray
public static byte[] toByteArray(int hashValue) Returns the given hash value as byte array.The given integer hash value is mapped to the returned byte array in little-endian order.
- Parameters:
hashValue- a 32-bit hash value- Returns:
- a byte array of length 4
-
toByteArray
public static byte[] toByteArray(long hashValue) Returns the given hash value as byte array.The given long hash value is mapped to the returned byte array in little-endian order.
- Parameters:
hashValue- a 32-bit hash value- Returns:
- a byte array of length 4
-
toByteArray
Returns the given hash value as byte array.- Parameters:
hashValue- a 128-bit hash value- Returns:
- a byte array of length 16
-
toHexString
Returns the hex-code representation of the hash value interpreted as numeric value.The returned hex-codes are given in reverse order with respect to the byte sequence as given by
toByteArray(int).- Parameters:
hashValue- a 32-bit hash value- Returns:
- a hex-string of length 8
-
toHexString
Returns the hex-code representation of the hash value interpreted as numeric value.The returned hex-codes are given in reverse order with respect to the byte sequence as given by
toByteArray(long).- Parameters:
hashValue- a 64-bit hash value- Returns:
- a hex-string of length 16
-
toHexString
Returns the hex-code representation of the hash value interpreted as numeric value.The returned hex-codes are given in reverse order with respect to the byte sequence as given by
toByteArray(HashValue128).- Parameters:
hashValue- a 128-bit hash value- Returns:
- a hex-string of length 32
-