Expand description
BLAKE3, the hash the shape tag is made of (15 section 3.1).
Written here rather than depended on, for the same reason crc, wyhash
and xxh3 are written here: the shape tag is a number six language bindings
have to agree on byte for byte forever, so the algorithm is part of the
format and belongs next to the other two hashes the format already pins.
The published crate also compiles assembly through a C toolchain by default,
which is a build dependency the whole workspace would inherit for a hash
that runs once when a collection is opened.
This is the portable implementation, without the SIMD kernels. A shape description is a few hundred bytes and it is hashed at open time, never on a hot path, so a kernel that is four times faster would save nothing that could be measured. If a caller ever needs BLAKE3 on a hot path, that is the moment to add the kernels, and the test vectors here already cover them.
Only the plain hash is implemented. Keyed hashing, key derivation and the
extended output are the parts of BLAKE3 nothing in yo uses.
use yo_common::blake3;
let h = blake3::hash(b"");
assert_eq!(
blake3::to_hex(&h),
"af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262",
);Structs§
- Hasher
- The streaming hasher.