Class XXH3
java.lang.Object
org.infinispan.server.resp.commands.string.XXH3
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 Summary
Modifier and TypeMethodDescriptionstatic longhash64(byte[] input) Computes the XXH3-64 hash of the input bytes.static StringhashToHex(byte[] input) Computes the XXH3-64 hash and returns it as a 16-character hex string.static longparseHexDigest(String hex) Parses a 16-character hexadecimal string to a long value.static StringtoHexString(long value) Converts a long value to a 16-character lowercase hexadecimal string.
-
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
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
Converts a long value to a 16-character lowercase hexadecimal string. -
parseHexDigest
Parses a 16-character hexadecimal string to a long value.- Parameters:
hex- the hexadecimal string- Returns:
- the parsed long value, or -1 if invalid
-