Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include "barretenberg/boomerang_value_detection/graph.hpp"
#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/common/test.hpp"
#include "barretenberg/crypto/sha256/sha256.hpp"
#include "barretenberg/stdlib/hash/sha256/sha256.hpp"
#include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp"
#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"
#include "barretenberg/numeric/bitop/rotate.hpp"
#include "barretenberg/numeric/bitop/sparse_form.hpp"
#include "barretenberg/numeric/random/engine.hpp"
Go to the source code of this file.
Typedefs | |
using | Builder = UltraCircuitBuilder |
using | byte_array_ct = byte_array< Builder > |
using | field_ct = field_t< Builder > |
Functions | |
std::vector< field_ct > | pack_bytes_into_field_elements (const byte_array_ct &input, size_t num_bytes_in_chunk=4) |
Given a byte_array object, slice it into chunks of size num_bytes_in_chunk and compute field elements reconstructed from these chunks. | |
void | fix_vector (std::vector< field_ct > &vector) |
void | fix_byte_array (byte_array_ct &input) |
TEST (boomerang_stdlib_sha256, test_graph_for_sha256_55_bytes) | |
Test for SHA256 circuit graph analysis. | |
HEAVY_TEST (boomerang_stdlib_sha256, test_graph_for_sha256_NIST_vector_five) | |
Test SHA256 circuit graph analysis with NIST test vector 5. | |
TEST (boomerang_stdlib_sha256, test_graph_for_sha256_NIST_vector_one) | |
Test SHA256 circuit graph analysis with NIST test vector 1. | |
TEST (boomerang_stdlib_sha256, test_graph_for_sha256_NIST_vector_two) | |
Test SHA256 circuit graph analysis with NIST test vector 2. | |
TEST (boomerang_stdlib_sha256, test_graph_for_sha256_NIST_vector_three) | |
Test SHA256 circuit graph analysis with NIST test vector 3. | |
TEST (boomerang_stdlib_sha256, test_graph_for_sha256_NIST_vector_four) | |
Test SHA256 circuit graph analysis with NIST test vector 4. | |
using Builder = UltraCircuitBuilder |
Definition at line 18 of file graph_description_sha256.test.cpp.
using byte_array_ct = byte_array<Builder> |
Definition at line 19 of file graph_description_sha256.test.cpp.
Definition at line 20 of file graph_description_sha256.test.cpp.
void fix_byte_array | ( | byte_array_ct & | input | ) |
Definition at line 54 of file graph_description_sha256.test.cpp.
void fix_vector | ( | std::vector< field_ct > & | vector | ) |
static analyzer usually prints input and output variables as variables in one gate. In tests these variables are not dangerous and usually we can filter them by adding gate for fixing witness. Then these variables will be in 2 gates, and static analyzer won't print them. functions fix_vector and fix_byte_array do it for vector of variables and byte_array respectively
Definition at line 47 of file graph_description_sha256.test.cpp.
HEAVY_TEST | ( | boomerang_stdlib_sha256 | , |
test_graph_for_sha256_NIST_vector_five | |||
) |
Test SHA256 circuit graph analysis with NIST test vector 5.
This test verifies the graph structure of a SHA256 circuit when processing a large input of 1000 repeated 'A' characters (NIST test vector 5).
The test checks that:
This is marked as a HEAVY_TEST due to the large input size requiring significant computation.
Definition at line 103 of file graph_description_sha256.test.cpp.
std::vector< field_ct > pack_bytes_into_field_elements | ( | const byte_array_ct & | input, |
size_t | num_bytes_in_chunk = 4 |
||
) |
Given a byte_array
object, slice it into chunks of size num_bytes_in_chunk
and compute field elements reconstructed from these chunks.
Definition at line 27 of file graph_description_sha256.test.cpp.
TEST | ( | boomerang_stdlib_sha256 | , |
test_graph_for_sha256_55_bytes | |||
) |
Test for SHA256 circuit graph analysis.
These tests verify that SHA256 circuits have the expected graph structure:
Definition at line 70 of file graph_description_sha256.test.cpp.
TEST | ( | boomerang_stdlib_sha256 | , |
test_graph_for_sha256_NIST_vector_four | |||
) |
Test SHA256 circuit graph analysis with NIST test vector 4.
This test verifies the graph structure of a SHA256 circuit when processing 4 bytes "c98c8e55" (NIST test vector 4).
Definition at line 205 of file graph_description_sha256.test.cpp.
TEST | ( | boomerang_stdlib_sha256 | , |
test_graph_for_sha256_NIST_vector_one | |||
) |
Test SHA256 circuit graph analysis with NIST test vector 1.
This test verifies the graph structure of a SHA256 circuit when processing the input string "abc" (NIST test vector 1).
The test checks that:
Definition at line 143 of file graph_description_sha256.test.cpp.
TEST | ( | boomerang_stdlib_sha256 | , |
test_graph_for_sha256_NIST_vector_three | |||
) |
Test SHA256 circuit graph analysis with NIST test vector 3.
This test verifies the graph structure of a SHA256 circuit when processing the input byte 0xbd
Definition at line 183 of file graph_description_sha256.test.cpp.
TEST | ( | boomerang_stdlib_sha256 | , |
test_graph_for_sha256_NIST_vector_two | |||
) |
Test SHA256 circuit graph analysis with NIST test vector 2.
This test verifies the graph structure of a SHA256 circuit when processing the input string "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" (NIST test vector 2).
Definition at line 163 of file graph_description_sha256.test.cpp.