Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
sha256.fuzzer.cpp
Go to the documentation of this file.
1#include "sha256.hpp"
5#include <cstdint>
6#include <vector>
7
8using namespace bb;
9using namespace bb::stdlib;
10
11extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size)
12{
13 if (Size == 0)
14 return 0;
16 std::vector<uint8_t> input_vec(Data, Data + Size);
17
19 auto output_bits = SHA256<UltraCircuitBuilder>::hash(input);
20 auto output_str = output_bits.get_value();
21 auto circuit_output = std::vector<uint8_t>(output_str.begin(), output_str.end());
22
23 auto expected = crypto::sha256(input_vec);
24
25 assert(circuit_output == expected);
27 return 0;
28}
static bool check(const Builder &circuit)
Check the witness satisifies the circuit.
static byte_array< Builder > hash(const byte_array_ct &input)
Definition sha256.cpp:308
Represents a dynamic array of bytes in-circuit.
AluTraceBuilder builder
Definition alu.test.cpp:123
Sha256Hash sha256(const ByteContainer &input)
Definition sha256.cpp:142
Entry point for Barretenberg command-line interface.
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)