Skip to main content

Crate qp_poseidon_core

Crate qp_poseidon_core 

Source

Modules§

serialization
Serialization utilities for Goldilocks field elements.

Structs§

Poseidon2State

Constants§

COMPACT_BYTES_PER_FELT
Bytes per field element in compact encoding.
PROOF_NODE_MAX_SIZE_BYTES
Maximum size of a storage proof node in bytes. Worst-case branch node: 8 (header) + 32 (partial key) + 8 (bitmap) + 512 (16 children) + 40 (value) = 600 bytes. We use 640 bytes to provide some margin.
PROOF_NODE_MAX_SIZE_FELTS
Maximum storage proof node size in field elements using compact encoding (7 bytes/felt). This is the single source of truth for circuit witness sizing. Includes +1 for the length prefix that makes the encoding injective. Calculation: ceil(640 / 7) + 1 = 92 + 1 = 93

Functions§

hash_bytes
Hash bytes to a 32-byte digest.
hash_felts_for_circuit
Hash field elements for circuit compatibility.
hash_for_circuit
Hash bytes for circuit compatibility using compact encoding (7 bytes/felt).
hash_squeeze_twice
Hash with 512-bit output by squeezing the sponge twice.
hash_to_bytes
Hash field elements to a 32-byte digest.
hash_to_felts
Hash field elements to 4 field elements (native Poseidon2 output).
hash_twice
Double hash: hash(hash(input)), returning bytes.
hash_twice_to_felts
Double hash: hash(hash(input)), returning 4 field elements.
poseidon2_from_seed
rehash_to_bytes
Re-hash a 32-byte digest to produce a new 32-byte digest.