Expand description
blakity – a tiny, portable BLAKE3.
A #![no_std] BLAKE3 in a single
file with no dependencies, derived from upstream’s reference_impl. It
targets small binaries (UEFI and other no_std builds) while staying faster
than the reference implementation, without SIMD intrinsics or
platform-specific code.
The API is the same as upstream’s reference_impl: a Hasher for the
regular hash, the keyed hash and the key derivation function, whose
finalize fills an output slice of any length (the
extendable output). On top of it, hash hashes a whole input at once
into a [Hash], which converts to and from hex.
§Examples
let hash = blakity::hash(b"abc");
let hex = "6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85";
assert_eq!(hash.to_string(), hex);
assert_eq!(blakity::Hash::from_hex(hex), Some(hash));let mut hasher = blakity::Hasher::new();
hasher.update(b"abc");
hasher.update(b"def");
let mut hash = [0; 32];
hasher.finalize(&mut hash);
let mut extended_hash = [0; 500];
hasher.finalize(&mut extended_hash);
assert_eq!(hash, extended_hash[..32]);§Cargo features
No features are currently defined.
Structs§
- Hash
- A 32-byte BLAKE3 output, as returned by
hash. - Hasher
- An incremental hasher that can accept any number of writes.