[][src]Crate dusk_poseidon_merkle

Poseidon Merkle Tree

Build Status Repository Documentation

Reference implementation for the Poseidon Merkle function.

The Poseidon structure will accept a number of inputs equal to the arity of the tree.

Build

A few environment variables will be read in the build process.

Example

use dusk_poseidon_merkle::{MERKLE_ARITY, Poseidon, Scalar};

let mut h = Poseidon::default();
for i in 0..MERKLE_ARITY {
    h.push(Scalar::from(i as u64)).unwrap();
}

let hash = h.hash();
println!("{:x?}", hash.as_bytes());

Reference

Starkad and Poseidon: New Hash Functions for Zero Knowledge Proof Systems

Structs

MerkleTree

The merkle tree will accept up to MERKLE_ARITY * MERKLE_WIDTH leaves.

Poseidon

The Poseidon structure will accept a number of inputs equal to the arity.

Proof

Set of pairs (idx, Hash) to reconstruct the merkle root. For every level of the tree, Required information to reconstruct the merkle root.

Scalar

The Scalar struct holds an integer \(s < 2^{255} \) which represents an element of \(\mathbb Z / \ell\).

Enums

Error

Possible error states for the hashing.

Constants

MERKLE_ARITY

Arity of the merkle tree

MERKLE_WIDTH

Width of the merkle tree

Traits

PoseidonLeaf

The items for the MerkleTree and Poseidon must implement this trait