Skip to content

@circom:poseidon

Hash 1-16 field elements with the circomlib Poseidon permutation over the BN254 scalar field (the hash used by Semaphore, Tornado and most circom circuits).

⚗️ Experimental — available at next.evmcrispr.com.

Returns: number

@circom:poseidon(...inputs)
NameTypeDescription
[...inputs]number1-16 field elements to hash (numbers, decimal strings or hex values)
# Hash two values with Poseidon (e.g. a commitment to a secret and a nullifier)
set $commitment @circom:poseidon(1234 5678)
print "Commitment:" $commitment
  • Uses the circomlib Poseidon parameters over the BN254 scalar field — outputs match circomlib/poseidon.circom, Semaphore and Tornado circuits.
  • Inputs are reduced into the field first (@circom:field semantics), so hex values and negative numbers are accepted.
  • Arity is part of the permutation: @circom:poseidon(1) and @circom:poseidon(1 0) are different hashes.