pub struct Cv { /* private fields */ }Expand description
The chaining value of a whole subtree, with its place: 2^level
chunks (1024 bytes each), the index-th subtree of that size in the
message. It is the only kind a left child can be.
A chaining value is the 32 bytes a BLAKE3 tree passes from a subtree up
to its parent. It is not a hash of anything a program can check alone,
and has its own type so that it is never taken for one: the root alone
gives a Hash (TreeHasher::root_hash).
Equality compares the place and, in constant time, the bytes. Debug
shows the place alone, so that a refusal’s message carries no chaining
value of a keyed tree.
§Trait implementations
Clonereproduces both the value and its place, including an unset slot.Copycopies the bytes and place together.Debugshows the place or the unset state without exposing chaining bytes.Eqidentifies values with equal bytes and place.PartialEqcompares the place and compares the chaining bytes in constant time.
Implementations§
Source§impl Cv
impl Cv
Sourcepub const fn unset() -> Cv
pub const fn unset() -> Cv
A slot not yet filled, for an array that a call will fill: every
call that takes a Cv as a subtree’s value refuses it
(as_bytes gives its 32 zero bytes). Zeroed memory
is the same value.
Sourcepub const fn at(level: u32, index: u64, bytes: [u8; 32]) -> Cv
pub const fn at(level: u32, index: u64, bytes: [u8; 32]) -> Cv
A chaining value a program stored or received, for the whole
subtree at level and index. The place is the program’s word:
bytes of another subtree give a wrong hash, as wrong input does.
Requires a level of at most 53 and a subtree that ends within a message’s 2^64 - 1 bytes.