Skip to main content

node_hash

Function node_hash 

Source
pub fn node_hash(left: &Hash, right: &Hash) -> Hash
Expand description

Interior hash: HASH(0x01 || left || right).

ยงExample

use publet_algorithms::log::{leaf_hash, node_hash, root};

let (a, b) = (leaf_hash(b"a"), leaf_hash(b"b"));
assert_eq!(node_hash(&a, &b), root(&[a, b]));
// Order matters: a log is a sequence.
assert_ne!(node_hash(&a, &b), node_hash(&b, &a));