Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
blake2s.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
8
9#include "../../primitives/field/field.hpp"
13
14namespace bb::stdlib {
15
16template <typename Builder> class Blake2s {
21
22 static constexpr uint32_t blake2s_IV[8] = { 0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL,
23 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL };
24
25 static constexpr uint32_t initial_H[8] = {
26 0x6b08e647, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
27 };
28
30 static constexpr uint32_t BLAKE2S_BLOCKBYTES = 64;
31
37
38 static void increment_counter(blake2s_state& S, const uint32_t inc);
39 static void compress(blake2s_state& S, byte_array_ct const& in);
40 static void blake2s(blake2s_state& S, byte_array_ct const& in);
41
42 public:
43 static byte_array_ct hash(const byte_array_ct& input);
44};
45
46} // namespace bb::stdlib
static void compress(blake2s_state &S, byte_array_ct const &in)
Definition blake2s.cpp:53
static constexpr uint32_t BLAKE2S_BLOCKBYTES
Definition blake2s.hpp:30
static void blake2s(blake2s_state &S, byte_array_ct const &in)
Definition blake2s.cpp:102
static constexpr uint32_t blake2s_IV[8]
Definition blake2s.hpp:22
static constexpr uint32_t initial_H[8]
Definition blake2s.hpp:25
static byte_array_ct hash(const byte_array_ct &input)
Definition blake2s.cpp:133
static void increment_counter(blake2s_state &S, const uint32_t inc)
Definition blake2s.cpp:40
static constexpr size_t BLAKE2S_STATE_SIZE
Definition blake2s.hpp:29
Implements boolean logic in-circuit.
Definition bool.hpp:59
Represents a dynamic array of bytes in-circuit.
field_t< Builder > f[2]
Definition blake2s.hpp:35
field_t< Builder > t[2]
Definition blake2s.hpp:34
field_t< Builder > h[8]
Definition blake2s.hpp:33