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 {
19
20 static constexpr uint32_t blake2s_IV[8] = { 0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL,
21 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL };
22
23 static constexpr uint32_t initial_H[8] = {
24 0x6b08e647, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
25 };
26
28 static constexpr uint32_t BLAKE2S_BLOCKBYTES = 64;
29
35
36 static void increment_counter(blake2s_state& S, const uint32_t inc);
37 static void compress(blake2s_state& S, byte_array_ct const& in);
38 static void blake2s(blake2s_state& S, byte_array_ct const& in);
39
40 public:
41 static byte_array_ct hash(const byte_array_ct& input);
42};
43
44} // namespace bb::stdlib
static void compress(blake2s_state &S, byte_array_ct const &in)
Definition blake2s.cpp:49
static constexpr uint32_t BLAKE2S_BLOCKBYTES
Definition blake2s.hpp:28
static void blake2s(blake2s_state &S, byte_array_ct const &in)
Definition blake2s.cpp:98
static constexpr uint32_t blake2s_IV[8]
Definition blake2s.hpp:20
static constexpr uint32_t initial_H[8]
Definition blake2s.hpp:23
static byte_array_ct hash(const byte_array_ct &input)
Definition blake2s.cpp:122
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:27
Represents a dynamic array of bytes in-circuit.
field_t< Builder > f[2]
Definition blake2s.hpp:33
field_t< Builder > t[2]
Definition blake2s.hpp:32
field_t< Builder > h[8]
Definition blake2s.hpp:31