TreeUtil.validate_authpath

Compute the root hash of a tree given a leaf and its authentication path.

template TreeUtil(alias hash_2n_n, H, M)
@safe @nogc pure nothrow
H
validate_authpath
(
in ref H leaf
,
in uint leafidx
,
in H[] authpath
,
in M[] masks
)
in { assert (masks.length >= authpath.length, "Got to few bitmasks."); }
if (
is_hash_2n_n!(hash_2n_n, H) &&
2 * H.length == M.length
)

Parameters

leaf
Type: H

A leaf of the tree.

leafidx
Type: uint

The index of the leaf.

authpath
Type: H[]

Authentication path as generated by gen_subtree_authpath().

masks
Type: M[]

Bitmasks for the tree.

Meta