Function snarkvm_wasm::algorithms::merkle_tree::compute_root [−][src]
pub fn compute_root<H, HG, F, TB, CS>(
cs: CS,
parameters: &<HG as CRHGadget<H, F>>::ParametersGadget,
mask_parameters: &<HG as CRHGadget<H, F>>::ParametersGadget,
mask: &TB,
leaves: &[<HG as CRHGadget<H, F>>::OutputGadget]
) -> Result<<HG as CRHGadget<H, F>>::OutputGadget, SynthesisError> where
CS: ConstraintSystem<F>,
H: CRH,
F: PrimeField,
HG: MaskedCRHGadget<H, F>,
TB: ToBytesGadget<F>,
Expand description
Computes a root given leaves. Uses a nonce to mask the computation,
to ensure amortization resistance. Assumes the number of leaves is
for a full tree, so it hashes the leaves until there is only one element.