43 S.
t[0] = S.
t[0] + inc_scalar;
52 using namespace blake_util;
56 for (
size_t i = 0; i < BLAKE2S_STATE_SIZE; ++i) {
60 for (
size_t i = 0; i < 8; ++i) {
72 v[12] = lookup_1[ColumnIdx::C3][0];
75 v[13] = lookup_2[ColumnIdx::C3][0];
78 v[14] = lookup_3[ColumnIdx::C3][0];
81 v[15] = lookup_4[ColumnIdx::C3][0];
83 for (
size_t idx = 0; idx < 10; idx++) {
90 for (
size_t i = 0; i < 8; ++i) {
94 S.
h[i] = lookup_b[ColumnIdx::C3][0];
101 using namespace blake_util;
104 size_t size = in.
size();
106 while (size > BLAKE2S_BLOCKBYTES) {
107 increment_counter(S, BLAKE2S_BLOCKBYTES);
109 offset += BLAKE2S_BLOCKBYTES;
110 size -= BLAKE2S_BLOCKBYTES;
118 increment_counter(S,
static_cast<uint32_t
>(size));
126 for (
size_t i = 0; i < 8; i++) {
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)
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
bb::fr get_value() const
Given a := *this, compute its value given by a.v * a.mul + a.add.
WASM_EXPORT void blake2s(uint8_t const *data, out_buf32 out)
stdlib::field_t< Builder > field_ct
stdlib::byte_array< Builder > byte_array_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)
void write(B &buf, field2< base_field, Params > const &value)