zk/include/nil/crypto3/zk/snark/systems/ppzkadsnark/r1cs_ppzkadsnark/signature.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2018-2021 Mikhail Komarov <nemo@nil.foundation>
3 // Copyright (c) 2020-2021 Nikita Kaskov <nbering@nil.foundation>
4 //
5 // MIT License
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy
8 // of this software and associated documentation files (the "Software"), to deal
9 // in the Software without restriction, including without limitation the rights
10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 // copies of the Software, and to permit persons to whom the Software is
12 // furnished to do so, subject to the following conditions:
13 //
14 // The above copyright notice and this permission notice shall be included in all
15 // copies or substantial portions of the Software.
16 //
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 // SOFTWARE.
24 //---------------------------------------------------------------------------//
25 // @file Generic signature interface for ADSNARK.
26 //---------------------------------------------------------------------------//
27 
28 #ifndef CRYPTO3_ZK_SIGNATURE_HPP
29 #define CRYPTO3_ZK_SIGNATURE_HPP
30 
31 #include <nil/crypto3/zk/snark/schemes/ppzkadsnark/r1cs_ppzkadsnark/detail/basic_policy.hpp>
32 
33 namespace nil {
34  namespace crypto3 {
35  namespace zk {
36  namespace snark {
37 
38  template<typename CurveType>
39  struct kpT {
40  r1cs_ppzkadsnark_secret_key<CurveType> sk;
41  r1cs_ppzkadsnark_vkT<CurveType> vk;
42  };
43 
44  template<typename CurveType>
46 
47  template<typename CurveType>
48  r1cs_ppzkadsnark_signature<CurveType> sigSign(const r1cs_ppzkadsnark_secret_key<CurveType> &sk,
49  const label_type &label,
50  const typename CurveType::g2_type::value_type &Lambda);
51 
52  template<typename CurveType>
53  bool sigVerif(const r1cs_ppzkadsnark_vkT<CurveType> &vk, const label_type &label,
54  const typename CurveType::g2_type::value_type &Lambda,
55  const r1cs_ppzkadsnark_signature<CurveType> &sig);
56 
57  template<typename CurveType>
58  bool sigBatchVerif(const r1cs_ppzkadsnark_vkT<CurveType> &vk, const std::vector<label_type> &labels,
59  const std::vector<typename CurveType::g2_type::value_type> &Lambdas,
60  const std::vector<r1cs_ppzkadsnark_signature<CurveType>> &sigs);
61 
62  } // namespace snark
63  } // namespace zk
64  } // namespace crypto3
65 } // namespace nil
66 
67 #endif // CRYPTO3_ZK_SIGNATURE_HPP
vector(T, U...) -> vector< std::enable_if_t<(std::is_same_v< T, U > &&...), T >, 1+sizeof...(U)>
deduction guide for uniform initialization
kpT< CurveType > sigGen(void)
bool sigVerif(const r1cs_ppzkadsnark_vkT< CurveType > &vk, const label_type &label, const typename CurveType::g2_type::value_type &Lambda, const r1cs_ppzkadsnark_signature< CurveType > &sig)
r1cs_ppzkadsnark_signature< CurveType > sigSign(const r1cs_ppzkadsnark_secret_key< CurveType > &sk, const label_type &label, const typename CurveType::g2_type::value_type &Lambda)
bool sigBatchVerif(const r1cs_ppzkadsnark_vkT< CurveType > &vk, const std::vector< label_type > &labels, const std::vector< typename CurveType::g2_type::value_type > &Lambdas, const std::vector< r1cs_ppzkadsnark_signature< CurveType >> &sigs)
Definition: pair.hpp:31
Definition: zk/include/nil/crypto3/zk/snark/systems/ppzkadsnark/r1cs_ppzkadsnark/signature.hpp:39
r1cs_ppzkadsnark_secret_key< CurveType > sk
Definition: zk/include/nil/crypto3/zk/snark/systems/ppzkadsnark/r1cs_ppzkadsnark/signature.hpp:40
r1cs_ppzkadsnark_vkT< CurveType > vk
Definition: zk/include/nil/crypto3/zk/snark/systems/ppzkadsnark/r1cs_ppzkadsnark/signature.hpp:41