Skip to main content

content_hash

Function content_hash 

Source
pub fn content_hash(node: &AlephTree) -> NodeHash
Expand description

Deterministic content hash of an AlephTree node. Two structurally identical trees — same shape, same field values, regardless of how or where they were constructed — always hash to the same value; this is the identity Aleph-Next’s content-addressed storage keys definitions by, not their name or their position in a file.

Deliberately not stored as a field on any AlephTree node: hashing a node that contains its own hash would be self-referential. Callers that need a “this definition, with its hash” pairing should keep the hash alongside the tree (e.g. (NodeHash, AlephTree)) rather than inside it.