Class XXH3

java.lang.Object
org.infinispan.server.resp.commands.string.XXH3

public final class XXH3 extends Object
XXH3-64 hash function implementation.

This is a pure Java implementation of the XXH3-64 algorithm, compatible with the hash digests used by Redis 8.4.0+ for the DIGEST and DELEX commands.

Since:
16.2
  • Method Details

    • hash64

      public static long hash64(byte[] input)
      Computes the XXH3-64 hash of the input bytes.
      Parameters:
      input - the byte array to hash
      Returns:
      the 64-bit hash value
    • hashToHex

      public static String hashToHex(byte[] input)
      Computes the XXH3-64 hash and returns it as a 16-character hex string.
      Parameters:
      input - the byte array to hash
      Returns:
      the hash as a lowercase hexadecimal string
    • toHexString

      public static String toHexString(long value)
      Converts a long value to a 16-character lowercase hexadecimal string.
    • parseHexDigest

      public static long parseHexDigest(String hex)
      Parses a 16-character hexadecimal string to a long value.
      Parameters:
      hex - the hexadecimal string
      Returns:
      the parsed long value, or -1 if invalid