|
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/primitives/group/test_utils.hpp"#include "barretenberg/stdlib_circuit_builders/mega_circuit_builder.hpp"#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"Go to the source code of this file.
Classes | |
| class | Sha256Test< Builder > |
Macros | |
| #define | STDLIB_TYPE_ALIASES |
Typedefs | |
| using | BuilderTypes = ::testing::Types< bb::UltraCircuitBuilder, bb::MegaCircuitBuilder > |
Functions | |
| TYPED_TEST_SUITE (Sha256Test, BuilderTypes) | |
| TYPED_TEST (Sha256Test, BlockNistVectorOne) | |
| Test sha256_block against NIST vector one ("abc") | |
| TYPED_TEST (Sha256Test, BlockNistVectorTwo) | |
| Test sha256_block against NIST vector two (56-byte message) | |
| TYPED_TEST (Sha256Test, ExtendWitnessTamperingFailure) | |
| Test extend_witness constraints (boomerang attack regression) | |
| #define STDLIB_TYPE_ALIASES |
Definition at line 17 of file sha256.test.cpp.
| using BuilderTypes = ::testing::Types<bb::UltraCircuitBuilder, bb::MegaCircuitBuilder> |
Definition at line 24 of file sha256.test.cpp.
| TYPED_TEST | ( | Sha256Test | , |
| BlockNistVectorOne | |||
| ) |
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 39 of file sha256.test.cpp.
| TYPED_TEST | ( | Sha256Test | , |
| BlockNistVectorTwo | |||
| ) |
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 104 of file sha256.test.cpp.
| TYPED_TEST | ( | Sha256Test | , |
| ExtendWitnessTamperingFailure | |||
| ) |
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 180 of file sha256.test.cpp.
| TYPED_TEST_SUITE | ( | Sha256Test | , |
| BuilderTypes | |||
| ) |