## About XXH128 hash

XXH128 refers to a specific variant of the xxHash family of non-cryptographic hash functions developed by Yann Collet. It is designed to produce a 128-bit hash output, which provides a larger hash size compared to the more common variants like XXH32 (32-bit) and XXH64 (64-bit). XXH128 maintains the core principles of xxHash, emphasizing speed, efficiency, and good distribution of hash values.

### Characteristics of XXH128

**Output Size**:- XXH128 produces a fixed-length output of 128 bits (16 bytes).

**Initialization Value**:- Similar to other xxHash variants, XXH128 uses an initial seed value (
`seed`

) for hash calculation. This seed can be any arbitrary value chosen by the user to control the starting point of the hash computation.

- Similar to other xxHash variants, XXH128 uses an initial seed value (
**Hash Calculation**:- XXH128 processes the input data in blocks, typically of 16 bytes (128 bits) at a time.
- It utilizes a mix of bitwise operations, rotations, and additions with prime constants to process each block of data.
- The hash state is updated iteratively for each processed block until all data is processed.

**Properties**:- XXH128 is optimized for speed and efficiency, making it suitable for applications requiring rapid computation of 128-bit hash values.
- It maintains good dispersion properties, ensuring that small changes in input data result in significantly different hash values (avalanche effect).
- XXH128 is not designed for cryptographic purposes due to its predictable nature and vulnerability to collision attacks.

### Usage

**Applications**: XXH128 is commonly used in applications where a larger hash output size (128 bits) is required for data integrity checks, hash tables, and non-cryptographic hash-based operations.**Implementation**: Implementing XXH128 is straightforward due to its well-defined algorithm and efficient use of computational resources.

### Example Calculation

Given a sequence of bytes `data`

and an initial seed `seed`

, the XXH128 hash `XXH128(data, seed)`

is calculated as follows:

- Initialize the hash state with the seed value.
- Process each block of
`data`

(typically 16 bytes) using specific mixing operations. - Finalize the hash value to ensure good dispersion and avalanche effect.
- The final XXH128 hash value is returned after processing all data blocks.

### Security Considerations

- XXH128, like other xxHash variants, is not suitable for cryptographic purposes due to its vulnerability to collision attacks and its predictable nature.
- It should only be used in scenarios where speed and good distribution of hash values are more critical than cryptographic security.

### Summary

XXH128 (xxHash128) is a fast and efficient non-cryptographic hash function designed for rapid computation of 128-bit hash values. It extends the capabilities of the xxHash family by offering a larger hash output size, making it suitable for applications requiring larger hash values with high performance and reliability. However, it should not be used for cryptographic applications where strong security guarantees are needed.