|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include "sha256.hpp"#include "barretenberg/circuit_checker/circuit_checker.hpp"#include "barretenberg/common/test.hpp"#include "barretenberg/crypto/sha256/sha256.hpp"#include "barretenberg/numeric/random/engine.hpp"#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"Go to the source code of this file.
Typedefs | |
| using | Builder = UltraCircuitBuilder |
| using | field_ct = field_t< Builder > |
| using | witness_ct = witness_t< Builder > |
Functions | |
| TEST (stdlib_sha256, test_sha256_block_NIST_vector_one) | |
| Test sha256_block against NIST vector one ("abc") | |
| TEST (stdlib_sha256, test_sha256_block_NIST_vector_two) | |
| Test sha256_block against NIST vector two (56-byte message) | |
| TEST (stdlib_sha256, test_extend_witness_constraints) | |
| Test extend_witness constraints (boomerang attack regression) | |
| using Builder = UltraCircuitBuilder |
Definition at line 15 of file sha256.test.cpp.
Definition at line 16 of file sha256.test.cpp.
| using witness_ct = witness_t<Builder> |
Definition at line 17 of file sha256.test.cpp.
| TEST | ( | stdlib_sha256 | , |
| test_extend_witness_constraints | |||
| ) |
Test extend_witness constraints (boomerang attack regression)
This security test verifies that SHA256::extend_witness() properly constrains all 64 extended message schedule words. Modifying any word should cause circuit failure.
Definition at line 170 of file sha256.test.cpp.
| TEST | ( | stdlib_sha256 | , |
| test_sha256_block_NIST_vector_one | |||
| ) |
Test sha256_block against NIST vector one ("abc")
This tests the compression function directly by manually padding the message and comparing against the known NIST hash output.
For "abc" (3 bytes):
Definition at line 29 of file sha256.test.cpp.
| TEST | ( | stdlib_sha256 | , |
| test_sha256_block_NIST_vector_two | |||
| ) |
Test sha256_block against NIST vector two (56-byte message)
This tests chained compression by manually padding a two-block message and comparing against the known NIST hash output.
For "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" (56 bytes):
Definition at line 94 of file sha256.test.cpp.