xxh3 function

int xxh3(
  1. Uint8List input, {
  2. Uint8List? secret,
  3. int seed = 0,
  4. HashLongFunction hashLongFunction = kXXH3HashLongFunction64Bit,
})

Perform an XXH3 hash of the input data. The input data is provided as a Uint8List to avoid having to perform conversions internally.

Optionally, a secret may be specified (if none is specified, the default seed is used). If a secret is specified, it must be greater in length than kSecretSizeMin.

Per XXH3, the secret MUST look like a bunch of random bytes as the quality of the secret impacts the dispersion of the hash algorithm. "Trivial" or structured data such as repeated sequences or a text document should be avoided.

The seed may be customized (the default value of the seed is 0).

A custom HashLongFunction may also be specified. By default, this is the kXXH3HashLongFunction64Bit which is the HashLongFunction included with xxHash.

To convert a List of ints to a Uint8List, you can use Uint8List.fromList.

The resulting 64-bit value is returned as an int.

Implementation

int xxh3(
  Uint8List input, {
  Uint8List? secret,
  int seed = 0,
  HashLongFunction hashLongFunction = kXXH3HashLongFunction64Bit,
}) {
  return xXH3_64bitsInternal(
    input: input,
    seed: seed,
    secret: secret ?? kSecret,
    hashLongFunction: hashLongFunction,
  );
}