Reference implementation for the Poseidon Hashing algorithm.
This repository has been created so there's a unique library that holds the tools & functions required to perform Poseidon Hashes.
These hashes heavily rely on the Hades design for its inner permutation.
The library provides the two hashing techniques of Poseidon:
Sponge technique in Poseidon allows to hash an unlimited amount of data
into a single
The sponge hash technique requires a padding to be applied before the data can
This is done to avoid hash collisions as stated in the paper of the Poseidon Hash
algorithm. See: https://eprint.iacr.org/2019/458.pdf.
The inputs of the
sponge_hash are always
Scalar or need to be capable of being represented
The module provides two sponge hash implementations:
Sponge hash using
Scalaras backend. Which hashes the inputted
Scalars and returns a single
Sponge hash gadget using
dusk_plonk::Witnessas a backend. This technique is used/required when you want to proof pre-images of unconstrained data inside Zero-Knowledge PLONK circuits.
This crate contains info about all the functions that the library provides as well as the documentation regarding the data structures that it exports. To check it, please feel free to go to the documentation page
There are benchmarks for
cipher in their native form, operating on
Scalar, and as a zero-knowledge gadget, using
To run all benchmarks on your machine, run
in the repository.
To run a specific benchmark, run
cargo bench --bench <name>
where you replace
<name> with the benchmark name. For example to run the benchmarks for the poseidon cipher encription from the file 'benches/cipher_encrypt.rs', you would need to run
cargo bench --benches cipher_encrypt
This code is licensed under Mozilla Public License Version 2.0 (MPL-2.0). Please see LICENSE for further info.
Implementation designed by the dusk team.
- If you want to contribute to this repository/project please, check CONTRIBUTING.md
- If you want to report a bug or request a new feature addition, please open an issue on this repository.