Module hash4j

Class HashValues

java.lang.Object
com.dynatrace.hash4j.hashing.HashValues

public final class HashValues extends Object
Utility class for hash values.
  • 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

      public static byte[] toByteArray(HashValue128 hashValue)
      Returns the given hash value as byte array.
      Parameters:
      hashValue - a 128-bit hash value
      Returns:
      a byte array of length 16
    • toHexString

      public static String toHexString(int hashValue)
      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

      public static String toHexString(long hashValue)
      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

      public static String toHexString(HashValue128 hashValue)
      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