#[repr(u8)]pub enum TreeHashAlg {
Blake3 = 1,
Sha256 = 2,
}Expand description
Payload-tree hash.
Variants§
Blake3 = 1
Naturally tree-based and substantially faster than SHA-256.
Sha256 = 2
Listed in the format registry but not used to compute trees in this build: see
merkle::ensure_supported. The member remains to prevent reusing number 2
for another hash; otherwise old files would be read with the wrong
algorithm rather than rejected.
Implementations§
Source§impl TreeHashAlg
impl TreeHashAlg
Sourcepub fn from_u8(v: u8) -> Result<Self, CryptoError>
pub fn from_u8(v: u8) -> Result<Self, CryptoError>
Parse an identifier from a file.
Parsing a number and being able to execute it are distinct; previously this build
only did the first: it accepted tree_hash_id = 2, yet still computed the tree
using BLAKE3. Parsing therefore immediately passes a second boundary,
merkle::ensure_supported, the sole declaration of what this
build supports. A single place prevents the supported-algorithm list from
diverging from the hasher’s behavior.