|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Implements a cryptographic sponge over prime fields. Sponge construction follows the Duplex Sponge model (https://keccak.team/files/SpongeDuplex.pdf). Domain separation uses IV = (input_length << 64) per Section 4.2 of the Poseidon paper (https://eprint.iacr.org/2019/458.pdf). Permutation is Poseidon2 (https://eprint.iacr.org/2023/323.pdf). More...
#include <sponge.hpp>
Static Public Member Functions | |
| static FF | hash_internal (std::span< const FF > input) |
| Use the sponge to hash an input vector. | |
| static FF | hash_internal (std::span< const FF > input, FF iv) |
| Use the sponge to hash an input vector with a custom IV. | |
Private Member Functions | |
| FieldSponge (FF domain_iv) | |
| void | perform_duplex () |
| void | absorb (const FF &input) |
| FF | squeeze () |
Private Attributes | |
| std::array< FF, t > | state {} |
| std::array< FF, rate > | cache {} |
| size_t | cache_size = 0 |
Implements a cryptographic sponge over prime fields. Sponge construction follows the Duplex Sponge model (https://keccak.team/files/SpongeDuplex.pdf). Domain separation uses IV = (input_length << 64) per Section 4.2 of the Poseidon paper (https://eprint.iacr.org/2019/458.pdf). Permutation is Poseidon2 (https://eprint.iacr.org/2023/323.pdf).
Note: If we ever use this sponge class for more than 1 hash functions, we should move this out of poseidon2 and into its own directory
| FF | |
| rate | |
| capacity | |
| t | |
| Permutation |
Definition at line 33 of file sponge.hpp.
|
inlineprivate |
Definition at line 42 of file sponge.hpp.
|
inlineprivate |
Definition at line 58 of file sponge.hpp.
|
inlinestatic |
Use the sponge to hash an input vector.
| input | Field elements (a_0, ..., a_{N-1}) |
Definition at line 85 of file sponge.hpp.
|
inlinestatic |
Use the sponge to hash an input vector with a custom IV.
| input | Field elements (a_0, ..., a_{N-1}) |
| iv | Initial value for domain separation |
Definition at line 99 of file sponge.hpp.
|
inlineprivate |
Definition at line 44 of file sponge.hpp.
|
inlineprivate |
Definition at line 72 of file sponge.hpp.
|
private |
Definition at line 39 of file sponge.hpp.
|
private |
Definition at line 40 of file sponge.hpp.
|
private |
Definition at line 36 of file sponge.hpp.