From f819ec5a523e53e1d60a28aac220488cec86fca1 Mon Sep 17 00:00:00 2001 From: Vasiliy Olekhov Date: Wed, 11 Dec 2024 12:39:11 +0200 Subject: [PATCH] Removed pedersen --- crypto3/benchmarks/CMakeLists.txt | 1 - crypto3/benchmarks/zk/pedersen.cpp | 109 ----------------------------- 2 files changed, 110 deletions(-) delete mode 100644 crypto3/benchmarks/zk/pedersen.cpp diff --git a/crypto3/benchmarks/CMakeLists.txt b/crypto3/benchmarks/CMakeLists.txt index 7f3f40d1d1..d0fa4ea992 100644 --- a/crypto3/benchmarks/CMakeLists.txt +++ b/crypto3/benchmarks/CMakeLists.txt @@ -63,7 +63,6 @@ set(BENCHMARK_NAMES "multiprecision/big_int" "zk/lpc" - "zk/pedersen" ) foreach(BENCHMARK_NAME ${BENCHMARK_NAMES}) diff --git a/crypto3/benchmarks/zk/pedersen.cpp b/crypto3/benchmarks/zk/pedersen.cpp deleted file mode 100644 index d066c97c57..0000000000 --- a/crypto3/benchmarks/zk/pedersen.cpp +++ /dev/null @@ -1,109 +0,0 @@ -//---------------------------------------------------------------------------// -// Copyright (c) 2021 Mikhail Komarov -// Copyright (c) 2021 Nikita Kaskov -// Copyright (c) 2022 Ilia Shirobokov -// Copyright (c) 2024 Martun Karapetyan -// -// MIT License -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -//---------------------------------------------------------------------------// - -#define BOOST_TEST_MODULE pedersen_test - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include - -using namespace nil::crypto3; - -BOOST_AUTO_TEST_SUITE(pedersen_test_suite) - -BOOST_AUTO_TEST_CASE(pedersen_long_test) { - - // setup - using curve_type = algebra::curves::bls12<381>; - using curve_group_type = curve_type::template g1_type<>; - using field_type = typename curve_type::scalar_field_type; - - constexpr static const int n = 2000000000; - constexpr static const int k = 1999999999; - static curve_group_type::value_type g = algebra::random_element(); - static curve_group_type::value_type h = algebra::random_element(); - while (g == h) { - h = algebra::random_element(); - } - - typedef typename zk::commitments::pedersen pedersen_type; - - typedef typename pedersen_type::proof_type proof_type; - typedef typename pedersen_type::params_type params_type; - - params_type params; - - params.n = n; - params.k = k; - params.g = g; - params.h = h; - - BOOST_CHECK(g != h); - BOOST_CHECK(n >= k); - BOOST_CHECK(k > 0); - - // commit - constexpr static const field_type::value_type w = field_type::value_type(300000000); - - // eval - proof_type proof = pedersen_type::proof_eval(params, w); - - // verify - BOOST_CHECK(pedersen_type::verify_eval(params, proof)); - - std::vector idx; - std::vector idx_base; - for (int i = 1; i <= n; ++i) { - idx_base.push_back(i); - } - std::random_device rd; - std::mt19937 gen(rd()); - std::shuffle(idx_base.begin(), idx_base.end(), gen); - for (int i = 0; i < k; ++i) { - idx.push_back(idx_base[i]); - } - - BOOST_CHECK(idx.size() >= k); - field_type::value_type secret = pedersen_type::message_eval(params, proof, idx); - BOOST_CHECK(w == secret); -} - -BOOST_AUTO_TEST_SUITE_END()