32template <
typename FF,
size_t rate,
size_t capacity,
size_t t,
typename Permutation>
class FieldSponge {
56 for (
size_t i = 0; i < rate; ++i) {
59 state[rate] = domain_iv;
69 for (
size_t i = 0; i < rate; ++i) {
74 std::array<FF, rate> output;
75 for (
size_t i = 0; i < rate; ++i) {
115 for (
size_t i = 0; i < rate; ++i) {
116 cache[i] = new_output_elements[i];
139 size_t in_len = input.size();
141 return hash_internal<out_len>(input, iv);
148 size_t in_len = input.size();
149 for (
size_t i = 0; i < in_len; ++i) {
154 for (
size_t i = 0; i < out_len; ++i) {
Implements a cryptographic sponge over prime fields. Implements the sponge specification from the Com...
FieldSponge(FF domain_iv=0)
static FF hash_internal(std::span< const FF > input)
void absorb(const FF &input)
static std::array< FF, out_len > hash_internal(std::span< const FF > input, FF iv)
std::array< FF, rate > perform_duplex()
std::array< FF, rate > cache
static std::array< FF, out_len > hash_internal(std::span< const FF > input)
Use the sponge to hash an input string.
std::array< FF, t > state
static FF hash_internal(std::span< const FF > input, FF iv)
Mode
Defines what phase of the sponge algorithm we are in.
static State permutation(Builder *builder, const State &input)
Circuit form of Poseidon2 permutation from https://eprint.iacr.org/2023/323.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept