Skip to content

Commit

Permalink
sha256 compression constraints #16
Browse files Browse the repository at this point in the history
  • Loading branch information
Luannet committed Apr 11, 2022
1 parent 5bc44f3 commit 5a777ae
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 28 deletions.
1 change: 1 addition & 0 deletions include/nil/crypto3/zk/blueprint/plonk.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2020-2021 Mikhail Komarov <nemo@nil.foundation>
// Copyright (c) 2020-2021 Nikita Kaskov <nbering@nil.foundation>
// Copyright (c) 2022 Alisa Cherniaeva <a.cherniaeva@nil.foundation>
//
// MIT License
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2021 Mikhail Komarov <nemo@nil.foundation>
// Copyright (c) 2021 Nikita Kaskov <nbering@nil.foundation>
// Copyright (c) 2022 Alisa Cherniaeva <a.cherniaeva@nil.foundation>
//
// MIT License
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2021 Mikhail Komarov <nemo@nil.foundation>
// Copyright (c) 2021 Nikita Kaskov <nbering@nil.foundation>
// Copyright (c) 2022 Alisa Cherniaeva <a.cherniaeva@nil.foundation>
//
// MIT License
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2021 Mikhail Komarov <nemo@nil.foundation>
// Copyright (c) 2021 Nikita Kaskov <nbering@nil.foundation>
// Copyright (c) 2022 Alisa Cherniaeva <a.cherniaeva@nil.foundation>
//
// MIT License
//
Expand Down
193 changes: 166 additions & 27 deletions include/nil/crypto3/zk/components/hashes/sha256/plonk/sha256.hpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2021 Mikhail Komarov <nemo@nil.foundation>
// Copyright (c) 2021 Nikita Kaskov <nbering@nil.foundation>
// Copyright (c) 2022 Alisa Cherniaeva <a.cherniaeva@nil.foundation>
//
// MIT License
//
Expand Down
1 change: 1 addition & 0 deletions test/hashes/plonk/poseidon.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2021-2022 Mikhail Komarov <nemo@nil.foundation>
// Copyright (c) 2021-2022 Nikita Kaskov <nbering@nil.foundation>
// Copyright (c) 2022 Alisa Cherniaeva <a.cherniaeva@nil.foundation>
//
// MIT License
//
Expand Down
5 changes: 4 additions & 1 deletion test/hashes/plonk/sha256.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2021-2022 Mikhail Komarov <nemo@nil.foundation>
// Copyright (c) 2021-2022 Nikita Kaskov <nbering@nil.foundation>
// Copyright (c) 2022 Alisa Cherniaeva <a.cherniaeva@nil.foundation>
//
// MIT License
//
Expand Down Expand Up @@ -55,6 +56,8 @@ BOOST_AUTO_TEST_CASE(blueprint_plonk_sha256) {
constexpr std::size_t PublicInputColumns = 0;
constexpr std::size_t ConstantColumns = 2;
constexpr std::size_t SelectorColumns = 5;
using hash_type = nil::crypto3::hashes::keccak_1600<256>;
constexpr std::size_t Lambda = 1;

using ArithmetizationParams = zk::snark::plonk_arithmetization_params<WitnessColumns,
PublicInputColumns, ConstantColumns, SelectorColumns>;
Expand All @@ -68,7 +71,7 @@ BOOST_AUTO_TEST_CASE(blueprint_plonk_sha256) {
std::array<typename ArithmetizationType::field_type::value_type, 8> input_state = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
std::array<typename ArithmetizationType::field_type::value_type, 16> input_words = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
typename component_type::private_params_type private_params = {input_state, input_words};
test_component<component_type, BlueprintFieldType, ArithmetizationParams> (public_params, private_params);
test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda> (public_params, private_params);
}

BOOST_AUTO_TEST_SUITE_END()
1 change: 1 addition & 0 deletions test/verifiers/kimchi/basic_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (c) 2021-2022 Mikhail Komarov <nemo@nil.foundation>
// Copyright (c) 2021-2022 Nikita Kaskov <nbering@nil.foundation>
// Copyright (c) 2022 Ilia Shirobokov <i.shirobokov@nil.foundation>
// Copyright (c) 2022 Alisa Cherniaeva <a.cherniaeva@nil.foundation>
//
// MIT License
//
Expand Down
1 change: 1 addition & 0 deletions test/verifiers/kimchi/scalar_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (c) 2021-2022 Mikhail Komarov <nemo@nil.foundation>
// Copyright (c) 2021-2022 Nikita Kaskov <nbering@nil.foundation>
// Copyright (c) 2022 Ilia Shirobokov <i.shirobokov@nil.foundation>
// Copyright (c) 2022 Alisa Cherniaeva <a.cherniaeva@nil.foundation>
//
// MIT License
//
Expand Down

0 comments on commit 5a777ae

Please sign in to comment.