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
)
if (
is_hash_2n_n!(hash_2n_n, H) &&
2 * H.length == M.length
)

Parameters

leaf H

A leaf of the tree.

leafidx uint

The index of the leaf.

authpath H[]

Authentication path as generated by gen_subtree_authpath().

masks M[]

Bitmasks for the tree.

Meta