The Poseidon Hash

Used for the different purposes

The Poseidon is a hash function designed for zero-knowledge proof systems like zkSNARKs. It operates over the GF(p)GF(p) prime field. The main advantage of the Poseidon hash is simplification in circuits building.

The Poseidon contains a series of rounds each based on input permutations (add constants, exponentiation and mixing). An S-box routine is just an exponentiation number in the GF(p)GF(p) field (the power of 5).

The round constants and S-box operations count depend on the parameter set. The Poseidon parameters are a tuple (t,f,p,c,m)(t, f, p, c, m), where

  • tt is a number of S-box routines in one round. It also specifies an input dimension: hash function supports up to tt input numbers.

  • ff is a full rounds count (tt S-box routines)

  • pp is a partial rounds count (single S-box routine)

  • cc is a round constants array ((f+p)×t(f+p) \times t dimension)

  • mm is a square array used for a mixing function (t×tt \times t dimension)

The Poseidon routine produces a resulting hash (over prime field) after (f+p)(f+p) rounds.

As mentioned previously there are different parameter sets used for hashes in the Merkle tree. These hash types are explained in the table below. The parameter set is presented in the reduced form (just a tuple(t,f,p)(t, f, p)):

LabelParametersHash purposeInputs

HashHash

2, 8, 56

Key derivation (η\eta and PdP_d)

Transaction verifier keyAA or diversifier dd

HashmerkleHash_{merkle}/ HashnullifierHash_{nullifier}

3, 8, 56

Merkle tree's node; Nullifier

two child nodes or leafs; Account hash and intermediate nullifier hash (details)

HasheddsaHash_{eddsa}/HashinhHash_{inh}

4, 8, 56

EDDSA sign and verify; Intermediate nullifier hash (inh)

R.x,A.x,HR.x, A.x, H​ (details) Hash(acc)Hash(acc), η\eta, pathpath (details)

HashnoteHash_{note}

5, 8, 56

Note hash

d,Pd,b,td, P_d, b, t (details)

HashaccountHash_{account}/HashspongeHash_{sponge}

6, 8, 57

Account hash;

Transaction hash

d,Pd,i,bd, P_d, i, b (details)​;

account and notes hashes with transaction commitment (details)

Poseidon specification

This page provides just a simple description of the Poseidon hash function. For additional details please refer to the original publication. It contains exhaustive materials, security investigations, implementation details, proof system applications and so on.

Last updated