xxh3 1.1.0 xxh3: ^1.1.0 copied to clipboard
A Dart implementation (port) of the XXH3 hashing algorithm from xxHash.
import 'dart:convert' show utf8;
import 'package:xxh3/xxh3.dart';
void main() {
// Get the string as UTF-8 bytes.
final helloWorldBytes = utf8.encode("Hello, world!");
// Use XXH3 to hash the byte array (returns an int).
// XXH3 is a 64-bit hash, so the value is returned in the
// form of an unsigned 64-bit integer.
final int digest = xxh3(helloWorldBytes);
print(digest); // -881777603154417559
// Alternatively, in version 1.1.0+, you can use the
// xxh3String convenience method to get a hexadecimal
// string representation of the hash.
final String hexDigest = xxh3String(helloWorldBytes);
print(hexDigest); // f3c34bf11915e869
// See the examples and documentation for more...
}