29 releases (12 breaking)
|0.30.1||Jun 28, 2023|
|0.29.1-rc.0||Jun 23, 2023|
|0.28.1||Jan 18, 2023|
|0.28.0||Oct 27, 2022|
|0.20.0-pre.1||Mar 31, 2021|
#1493 in Cryptography
425 downloads per month
Used in 10 crates (8 directly)
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.
This hashes heavily rely on the Hades permutation, which is one of the key parts that Poseidon needs in order to work. This library uses the reference implementation of Dusk-Hades which has been designed & build by the Dusk-Network team.
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.