pub fn node_digest(left: b256, right: b256) -> b256 
Expand description

Returns the computed node hash of “MTH(D[n]) = SHA-256(0x01 || MTH(D[0:k]) || MTH(D[k:n]))”.

Arguments

  • ‘left’: [b256] - The hash of the left node.
  • ‘right’: [b256] - The hash of the right node.

Returns

  • [b256] - The hash of the node data.

Examples

use sway_libs::merkle::binary_proof::node_digest;

fn foo() {
    let leaf_1 = b256::zero();
    let leaf_2 = b256::zero();
    let digest = node_digest(leaf_1, leaf_2);
    assert(digest == 0xee510d4daf24756c7b56b56b838212b193d9265c85c4a3b2c74f5a3189477c80);
}