XXH128
less than a minute
Overview
The XXH128 converter computes a 128-bit xxHash XXH128 hash of a string and returns it as a hexadecimal string. Like XXH3, XXH128 is a non-cryptographic hash function designed for speed. The 128-bit output reduces collision probability compared to 64-bit XXH3, making it suitable for unique identifier generation and content addressing.
Syntax
XXH128(value)
- value: the string to hash
Examples
Input
{
"_type": "log",
"body": {
"short_text": "Hello, World!",
"long_text": "The quick brown fox jumps over the lazy dog"
},
"resource": {...},
"attributes": {}
}
Statement
set(attributes["hash_short"], XXH128(body["short_text"]))
set(attributes["hash_long"], XXH128(body["long_text"]))
Output
{
"_type": "log",
"body": {
"short_text": "Hello, World!",
"long_text": "The quick brown fox jumps over the lazy dog"
},
"resource": {...},
"attributes": {
"hash_short": "531df2844447dd5077db03842cd75395",
"hash_long": "ddd650205ca3e7fa24a1cc2e3a8a7651"
}
}
Each string produced a deterministic 32-character hexadecimal hash. The 128-bit output is twice the length of XXH3 (16 characters), providing a lower collision probability.