Functions
extern fn fnv1a(s: string) -> int#
FNV-1a 64-bit: h = (h ^ byte) * 0x100000001b3 from the offset basis. Returns the u64 digest as its i64 bit pattern.
s: Bytes to digest.
println(std.hash.fnv1a("moon")) // 962909002217842368extern fn wyhash(s: string, seed: int) -> int#
wyhash of s with seed (the u64 seed as an i64 bit pattern); returns the u64 digest as its i64 bit pattern.
s: Bytes to digest.seed: Seed mixed into the digest, as an i64 bit pattern.
println(std.hash.wyhash("moon", 0)) // -6791431709886985029
println(std.hash.wyhash("moon", 1)) // -780482596724781700extern fn crc32(s: string) -> int#
CRC-32 (IEEE, the zlib polynomial), returned zero-extended (0..2^32-1).
s: Bytes to digest.
println(std.hash.crc32("moon")) // 3823912936extern fn sha256(s: string) -> string#
SHA-256 digest as lowercase hex. Native (std.crypto): correctness- and timing-sensitive crypto stays out of the moon tree.
s: Bytes to digest.
println(std.hash.sha256("moon"))
// 9e78b43ea00edcac8299e0cc8df7f6f913078171335f733a21d5d911b6999132SHA-256 digest of a regular file as lowercase hex. The file is read in bounded chunks, so model archives and other large artifacts do not inherit std.fs.read_file's whole-file materialization limit.
path: File whose bytes to digest.
extern fn md5(s: string) -> string#