XXH64 — a fast, portable, high-quality non-cryptographic hash. Faithful MoonBit port of the reference xxHash.
moon add tonyfettes/xxh64import { "tonyfettes/xxh64" }///|
test {
// 64-bit hash of a byte buffer.
let h = @xxh64.xxh64(b"abc")
inspect(@xxh64.to_hex(h), content="44bc2cf5ad770999")
// A seed perturbs the result deterministically.
inspect(h == @xxh64.xxh64(b"abc", seed=1), content="false")
}fn xxh64(Bytes, seed? : UInt64) -> UInt64
fn to_hex(UInt64) -> Stringfn to_hex(hash : UInt64) -> Stringinspect(@xxh64.to_hex(@xxh64.xxh64(b"abc")), content="44bc2cf5ad770999")fn xxh64(data : Bytes, seed? : UInt64) -> UInt64inspect(@xxh64.to_hex(@xxh64.xxh64(b"abc")), content="44bc2cf5ad770999")XXH64 — a fast, portable, high-quality non-cryptographic hash. Faithful MoonBit port of the reference xxHash.