Skip to content

n4ru/dusk-poseidon-merkle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 96.3%
  • Makefile 3.7%