|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Implements a cryptographic sponge over prime fields. Implements the sponge specification from the Community Cryptographic Specification Project see https://github.com/C2SP/C2SP/blob/792c1254124f625d459bfe34417e8f6bdd02eb28/poseidon-sponge.md (Note: this spec was not accepted into the C2SP repo, we might want to reference something else!) More...
#include <sponge.hpp>
Public Types | |
| enum | Mode { ABSORB , SQUEEZE } |
| Defines what phase of the sponge algorithm we are in. More... | |
Public Member Functions | |
| FieldSponge (FF domain_iv=0) | |
| std::array< FF, rate > | perform_duplex () |
| void | absorb (const FF &input) |
| FF | squeeze () |
Static Public Member Functions | |
| template<size_t out_len> | |
| static std::array< FF, out_len > | hash_internal (std::span< const FF > input) |
| Use the sponge to hash an input string. | |
| template<size_t out_len> | |
| static std::array< FF, out_len > | hash_internal (std::span< const FF > input, FF iv) |
| static FF | hash_internal (std::span< const FF > input) |
| static FF | hash_internal (std::span< const FF > input, FF iv) |
Public Attributes | |
| std::array< FF, t > | state |
| std::array< FF, rate > | cache |
| size_t | cache_size = 0 |
| Mode | mode = Mode::ABSORB |
Implements a cryptographic sponge over prime fields. Implements the sponge specification from the Community Cryptographic Specification Project see https://github.com/C2SP/C2SP/blob/792c1254124f625d459bfe34417e8f6bdd02eb28/poseidon-sponge.md (Note: this spec was not accepted into the C2SP repo, we might want to reference something else!)
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 32 of file sponge.hpp.
| enum bb::crypto::FieldSponge::Mode |
Defines what phase of the sponge algorithm we are in.
ABSORB: 'absorbing' field elements into the sponge SQUEEZE: compressing the sponge and extracting a field element
| Enumerator | |
|---|---|
| ABSORB | |
| SQUEEZE | |
Definition at line 41 of file sponge.hpp.
|
inline |
Definition at line 54 of file sponge.hpp.
|
inline |
Definition at line 81 of file sponge.hpp.
|
inlinestatic |
Use the sponge to hash an input string.
| out_len |
| input |
Definition at line 137 of file sponge.hpp.
|
inlinestatic |
Definition at line 160 of file sponge.hpp.
|
inlinestatic |
Definition at line 144 of file sponge.hpp.
|
inlinestatic |
Definition at line 161 of file sponge.hpp.
|
inline |
Definition at line 62 of file sponge.hpp.
|
inline |
Definition at line 101 of file sponge.hpp.
| std::array<FF, rate> bb::crypto::FieldSponge< FF, rate, capacity, t, Permutation >::cache |
Definition at line 50 of file sponge.hpp.
| size_t bb::crypto::FieldSponge< FF, rate, capacity, t, Permutation >::cache_size = 0 |
Definition at line 51 of file sponge.hpp.
| Mode bb::crypto::FieldSponge< FF, rate, capacity, t, Permutation >::mode = Mode::ABSORB |
Definition at line 52 of file sponge.hpp.
| std::array<FF, t> bb::crypto::FieldSponge< FF, rate, capacity, t, Permutation >::state |
Definition at line 47 of file sponge.hpp.