45 S.
t[0] = S.
t[0] + inc_scalar;
49 bool_ct to_inc = S.
t[0].template ranged_less_than<32>(inc_scalar);
56 using namespace blake_util;
60 for (
size_t i = 0; i < BLAKE2S_STATE_SIZE; ++i) {
64 for (
size_t i = 0; i < 8; ++i) {
76 v[12] = lookup_1[ColumnIdx::C3][0];
79 v[13] = lookup_2[ColumnIdx::C3][0];
82 v[14] = lookup_3[ColumnIdx::C3][0];
85 v[15] = lookup_4[ColumnIdx::C3][0];
87 for (
size_t idx = 0; idx < 10; idx++) {
94 for (
size_t i = 0; i < 8; ++i) {
98 S.
h[i] = lookup_b[ColumnIdx::C3][0];
105 using namespace blake_util;
108 size_t size = in.
size();
110 while (size > BLAKE2S_BLOCKBYTES) {
111 increment_counter(S, BLAKE2S_BLOCKBYTES);
113 offset += BLAKE2S_BLOCKBYTES;
114 size -= BLAKE2S_BLOCKBYTES;
127 final.write(padding);
129 increment_counter(S,
static_cast<uint32_t
>(size));
137 for (
size_t i = 0; i < 8; i++) {
145 for (
const auto& h : S.
h) {
149 result.
write(reversed);
static void compress(blake2s_state &S, byte_array_ct const &in)
static void blake2s(blake2s_state &S, byte_array_ct const &in)
static byte_array_ct hash(const byte_array_ct &input)
static void increment_counter(blake2s_state &S, const uint32_t inc)
Implements boolean logic in-circuit.
Represents a dynamic array of bytes in-circuit.
byte_array slice(size_t offset) const
Slice bytes from the byte array starting at offset. Does not add any constraints.
byte_array reverse() const
Reverse the bytes in the byte array.
byte_array & write(byte_array const &other)
Appends the contents of another byte_array (other) to the end of this one.
Builder * get_context() const
static byte_array constant_padding(Builder *parent_context, size_t num_bytes, uint8_t value=0)
WASM_EXPORT void blake2s(uint8_t const *data, out_buf32 out)
stdlib::field_t< Builder > field_ct
void round_fn(field_t< Builder > state[BLAKE_STATE_SIZE], field_t< Builder > msg[BLAKE_STATE_SIZE], size_t round, const bool which_blake=false)
std::vector< uint8_t > compress(const std::vector< uint8_t > &input)