@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
Syntax
Section titled “Syntax”@circom:poseidon(...inputs)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
[...inputs] | number | 1-16 field elements to hash (numbers, decimal strings or hex values) |
Examples
Section titled “Examples”# 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.
See Also
Section titled “See Also”- @circom:field — the input reduction applied to every argument
- @circom:tree.root — Poseidon Merkle trees over field elements