Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
graph_description_sha256.test.cpp File Reference

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_ctpack_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.
 

Typedef Documentation

◆ Builder

Definition at line 18 of file graph_description_sha256.test.cpp.

◆ byte_array_ct

◆ field_ct

Definition at line 20 of file graph_description_sha256.test.cpp.

Function Documentation

◆ fix_byte_array()

void fix_byte_array ( byte_array_ct input)

Definition at line 54 of file graph_description_sha256.test.cpp.

◆ fix_vector()

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()

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:

  • The circuit consists of exactly 1 connected component
  • No variables appear in only one gate after witness fixing

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.

◆ pack_bytes_into_field_elements()

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() [1/5]

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:

  • Each circuit should consist of exactly 1 connected component
  • Each variable should appear in multiple gates after witness fixing The test mirrors the test in stdlib.

Definition at line 70 of file graph_description_sha256.test.cpp.

◆ TEST() [2/5]

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() [3/5]

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:

  • The circuit consists of exactly 1 connected component
  • No variables appear in only one gate after witness fixing

Definition at line 143 of file graph_description_sha256.test.cpp.

◆ TEST() [4/5]

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() [5/5]

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.