Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
blake2s.test.cpp
Go to the documentation of this file.
3#include "blake2s.hpp"
4#include <gtest/gtest.h>
5
6using namespace bb;
7using namespace bb::stdlib;
8
10
16
17TEST(stdlib_blake2s, test_single_block_plookup)
18{
20 std::string input = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz01";
21 std::vector<uint8_t> input_v(input.begin(), input.end());
22
23 byte_array_plookup input_arr(&builder, input_v);
25
26 auto expected = crypto::blake2s(input_v);
27
28 EXPECT_EQ(output.get_value(), std::vector<uint8_t>(expected.begin(), expected.end()));
29
30 info("builder gates = ", builder.get_estimated_num_finalized_gates());
31
32 bool proof_result = CircuitChecker::check(builder);
33 EXPECT_EQ(proof_result, true);
34}
35
36TEST(stdlib_blake2s, test_double_block_plookup)
37{
39 std::string input = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789";
40 std::vector<uint8_t> input_v(input.begin(), input.end());
41
42 byte_array_plookup input_arr(&builder, input_v);
44
45 auto expected = crypto::blake2s(input_v);
46
47 EXPECT_EQ(output.get_value(), std::vector<uint8_t>(expected.begin(), expected.end()));
48
49 info("builder gates = ", builder.get_estimated_num_finalized_gates());
50
51 bool proof_result = CircuitChecker::check(builder);
52 EXPECT_EQ(proof_result, true);
53}
static bool check(const Builder &circuit)
Check the witness satisifies the circuit.
static byte_array_ct hash(const byte_array_ct &input)
Definition blake2s.cpp:122
Represents a dynamic array of bytes in-circuit.
std::vector< uint8_t > get_value() const
A helper converting a byte_array into the vector of its uint8_t values.
void info(Args... args)
Definition log.hpp:70
AluTraceBuilder builder
Definition alu.test.cpp:123
std::array< uint8_t, BLAKE2S_OUTBYTES > blake2s(std::vector< uint8_t > const &input)
Definition blake2s.cpp:232
Entry point for Barretenberg command-line interface.
TEST(MegaCircuitBuilder, CopyConstructor)
UltraCircuitBuilder_< UltraExecutionTraceBlocks > UltraCircuitBuilder