xxh3 library

A Dart port of the XXH3 hashing function.

The original implementation by Cyan4973 is available on GitHub: https://github.com/Cyan4973/xxHash/

The algorithm's specification can be found, in Markdown, as part of the xxHash repository: https://github.com/Cyan4973/xxHash/blob/dev/doc/xxhash_spec.md

Classes

XXH3State
XXH3State is the internal stream state of the XXH3 hashing algorithm.

Constants

kSecretSizeMin → const int Buffer API Stream API
The absolute minimum size for a custom secret as defined in XXH3. See https://github.com/Cyan4973/xxHash/blob/b1a61dff654af43552b5ee05c737b6fd2a0ee14b/xxhash.h#L931
kXXH3HashLongFunction64Bit → const HashLongFunction Buffer API
The default HashLongFunction from xxHash. See HashLongFunction.
kXXH3SmallDataSize → const int Buffer API Stream API
The maximum size, in bytes, of a 'short' key. This is known internally to XXH3 as the 'mid-size max'.
kXXH3StreamBufferSize → const int Stream API
The optimal update size for incremental hashing. This size is used in the internal XXH3State when calling XXH3State.update.

Functions

xxh3(Uint8List input, {Uint8List? secret, int seed = 0, HashLongFunction hashLongFunction = kXXH3HashLongFunction64Bit}) int Buffer API
Perform an XXH3 hash of the input data. The input data is provided as a Uint8List to avoid having to perform conversions internally.
xxh3Stream({Uint8List? secret, int? seed}) XXH3State Stream API
Create an XXH3 stream (XXH3State). This state can be updated (XXH3State.update) with data as many times as desired, then digested with XXH3State.digest to compute the final hash.
xxh3String(Uint8List input, {Uint8List? secret, int seed = 0, HashLongFunction hashLongFunction = kXXH3HashLongFunction64Bit}) String Buffer API
A convenience wrapper for xxh3 that returns the result, formatted as an unsigned hexadecimal string.

Typedefs

HashLongFunction = int Function(ByteData input, int seed, ByteData secret) Buffer API
When hashing inputs of length greater than 240, the HashLongFunction is used. The default is kXXH3HashLongFunction64Bit.