Skip to content


Build Status Repository Documentation


Reference implementation for the Poseidon Hashing algorithm.


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

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 Hash

The Sponge technique in Poseidon allows to hash an unlimited amount of data into a single Scalar. The sponge hash technique requires a padding to be applied before the data can be hashed.

This is done to avoid hash collisions as stated in the paper of the Poseidon Hash algorithm. See: The inputs of the sponge_hash are always Scalar or need to be capable of being represented as it.

The module provides two sponge hash implementations:

  • Sponge hash using Scalar as backend. Which hashes the inputted Scalars and returns a single Scalar.

  • Sponge hash gadget using dusk_plonk::Witness as 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 sponge and cipher in their native form, operating on Scalar, and as a zero-knowledge gadget, using Witness.

To run all benchmarks on your machine, run

cargo bench

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/', 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
  • If you want to report a bug or request a new feature addition, please open an issue on this repository.