Module 0x2::poseidon
Module which defines instances of the poseidon hash functions.
use 0x2::bcs;
Constants
The field size for BN254 curve.
const BN254_MAX: u256 = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
Error if an empty vector is passed as input.
const EEmptyInput: u64 = 1;
Error if any of the inputs are larger than or equal to the BN254 field size.
const ENonCanonicalInput: u64 = 0;
Function poseidon_bn254
@param data: Vector of BN254 field elements to hash.
Hash the inputs using poseidon_bn254 and returns a BN254 field element.
Each element has to be a BN254 field element in canonical representation so it must be smaller than the BN254 scalar field size which is 21888242871839275222246405745257275088548364400416034343698204186575808495617.
public fun poseidon_bn254(data: &vector<u256>): u256
Click to open
Implementation
Function poseidon_bn254_internal
@param data: Vector of BN254 field elements in little-endian representation.
Hash the inputs using poseidon_bn254 and returns a BN254 field element in little-endian representation.
fun poseidon_bn254_internal(data: &vector<vector<u8>>): vector<u8>
Click to open