Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <blake3s.hpp>
Classes | |
struct | blake3_hasher |
struct | output_t |
Static Public Member Functions | |
static byte_array_ct | hash (const byte_array_ct &input) |
Private Types | |
enum | blake3_flags { CHUNK_START = 1 << 0 , CHUNK_END = 1 << 1 , PARENT = 1 << 2 , ROOT = 1 << 3 , KEYED_HASH = 1 << 4 , DERIVE_KEY_CONTEXT = 1 << 5 , DERIVE_KEY_MATERIAL = 1 << 6 } |
enum | blake3s_constant { BLAKE3_KEY_LEN = 32 , BLAKE3_OUT_LEN = 32 , BLAKE3_BLOCK_LEN = 64 , BLAKE3_CHUNK_LEN = 1024 } |
using | byte_array_ct = byte_array< Builder > |
using | field_ct = field_t< Builder > |
Static Private Member Functions | |
static void | compress_pre (field_t< Builder > state[BLAKE3_STATE_SIZE], const field_t< Builder > cv[8], const byte_array_ct &block, uint8_t block_len, uint8_t flags) |
static void | compress_in_place (field_t< Builder > cv[8], const byte_array_ct &block, uint8_t block_len, uint8_t flags) |
static void | compress_xof (const field_t< Builder > cv[8], const byte_array_ct &block, uint8_t block_len, uint8_t flags, byte_array_ct &out) |
static uint8_t | maybe_start_flag (const blake3_hasher *self) |
static output_t | make_output (const field_t< Builder > input_cv[8], const byte_array_ct &block, uint8_t block_len, uint8_t flags) |
static void | hasher_init (blake3_hasher *self) |
static void | hasher_update (blake3_hasher *self, const byte_array_ct &input, size_t input_len) |
static void | hasher_finalize (const blake3_hasher *self, byte_array_ct &out) |
Static Private Attributes | |
static constexpr size_t | BLAKE3_STATE_SIZE = stdlib::blake_util::BLAKE_STATE_SIZE |
static constexpr std::array< uint32_t, 8 > | IV |
Definition at line 14 of file blake3s.hpp.
|
private |
Definition at line 15 of file blake3s.hpp.
|
private |
Definition at line 16 of file blake3s.hpp.
|
private |
Enumerator | |
---|---|
CHUNK_START | |
CHUNK_END | |
PARENT | |
ROOT | |
KEYED_HASH | |
DERIVE_KEY_CONTEXT | |
DERIVE_KEY_MATERIAL |
Definition at line 24 of file blake3s.hpp.
|
private |
Enumerator | |
---|---|
BLAKE3_KEY_LEN | |
BLAKE3_OUT_LEN | |
BLAKE3_BLOCK_LEN | |
BLAKE3_CHUNK_LEN |
Definition at line 35 of file blake3s.hpp.
|
staticprivate |
At this point in the algorithm, a malicious prover could tweak the add_normalise function in blake_util.hpp
to create unexpected overflow in the state matrix. At the end of the compress_pre()
function, there might be overflows in the elements of the first and third rows of the state matrix. But this wouldn't be a problem because in the below loop, while reading from the lookup table, we ensure that the overflow is ignored and the result is contrained to 32 bits.
Definition at line 55 of file blake3s.cpp.
|
staticprivate |
Definition at line 21 of file blake3s.cpp.
|
staticprivate |
The same note as in the above blake3_compress_in_place()
function. Here too, reading from the lookup table ensures that correct 32-bit inputs are used.
Definition at line 77 of file blake3s.cpp.
|
static |
Definition at line 183 of file blake3s.cpp.
|
staticprivate |
Definition at line 171 of file blake3s.cpp.
|
staticprivate |
Definition at line 126 of file blake3s.cpp.
|
staticprivate |
Definition at line 142 of file blake3s.cpp.
|
staticprivate |
Definition at line 103 of file blake3s.cpp.
|
inlinestaticprivate |
Definition at line 71 of file blake3s.hpp.
|
staticconstexprprivate |
Definition at line 33 of file blake3s.hpp.
|
staticconstexprprivate |
Definition at line 37 of file blake3s.hpp.