Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.
dusk-networkPublic archive

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

20 stars

Watchers

1 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

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.

  • POSEIDON_MERKLE_ARITY

    Represents the arity of the merkle tree. This is also the maximum number of elements the poseidon hash will accept. Defaults to 4.

  • POSEIDON_MERKLE_WIDTH

    Represents the merkle tree width. Defaults to 64.

  • POSEIDON_FULL_ROUNDS

    Represents the number of full rounds performed during the permutation. Defaults to 8.

  • POSEIDON_PARTIAL_ROUNDS

    Represents the number of partial rounds performed during the permutation. Defaults to 59.

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

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

20 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages