r1cs_gg_ppzksnark/encrypted_input/prover.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2021 Mikhail Komarov <nemo@nil.foundation>
3 // Copyright (c) 2021 Ilias Khairullin <ilias@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 
26 #ifndef CRYPTO3_ZK_R1CS_GG_PPZKSNARK_ENCRYPTED_INPUT_PROVER_HPP
27 #define CRYPTO3_ZK_R1CS_GG_PPZKSNARK_ENCRYPTED_INPUT_PROVER_HPP
28 
30 
31 namespace nil {
32  namespace crypto3 {
33  namespace zk {
34  namespace snark {
43  template<typename CurveType>
48 
49  typedef typename CurveType::scalar_field_type scalar_field_type;
50  typedef typename CurveType::template g1_type<> g1_type;
51  typedef typename CurveType::template g2_type<> g2_type;
52  typedef typename CurveType::gt_type gt_type;
53 
54  public:
60 
61  // TODO: add type constraints on PublicKey
62  template<typename PublicKey>
63  static inline proof_type process(const proving_key_type &gg_proving_key,
64  const PublicKey &pubkey,
65  const primary_input_type &primary_input,
66  const auxiliary_input_type &auxiliary_input,
67  const typename scalar_field_type::value_type &r) {
68  proof_type proof = basic_prover_type::process(gg_proving_key, primary_input, auxiliary_input);
69 
70  return proof_type(std::move(proof.g_A),
71  std::move(proof.g_B),
72  std::move(r * pubkey.gamma_inverse_sum_s_g1 + proof.g_C));
73  }
74  };
75  } // namespace snark
76  } // namespace zk
77  } // namespace crypto3
78 } // namespace nil
79 
80 #endif // CRYPTO3_ZK_R1CS_GG_PPZKSNARK_ENCRYPTED_INPUT_PROVER_HPP
Definition: zk/include/nil/crypto3/zk/snark/systems/ppzksnark/r1cs_gg_ppzksnark/detail/basic_policy.hpp:248
basic_policy::primary_input_type primary_input_type
Definition: zk/include/nil/crypto3/zk/snark/systems/ppzksnark/r1cs_gg_ppzksnark/detail/basic_policy.hpp:263
basic_policy::extended_keypair_type keypair_type
Definition: zk/include/nil/crypto3/zk/snark/systems/ppzksnark/r1cs_gg_ppzksnark/detail/basic_policy.hpp:288
basic_policy::auxiliary_input_type auxiliary_input_type
Definition: zk/include/nil/crypto3/zk/snark/systems/ppzksnark/r1cs_gg_ppzksnark/detail/basic_policy.hpp:265
Definition: snark/proof.hpp:37
static proof_type process(const proving_key_type &gg_proving_key, const PublicKey &pubkey, const primary_input_type &primary_input, const auxiliary_input_type &auxiliary_input, const typename scalar_field_type::value_type &r)
Definition: r1cs_gg_ppzksnark/encrypted_input/prover.hpp:63
policy_type::proof_type proof_type
Definition: r1cs_gg_ppzksnark/encrypted_input/prover.hpp:59
policy_type::keypair_type keypair_type
Definition: r1cs_gg_ppzksnark/encrypted_input/prover.hpp:58
policy_type::auxiliary_input_type auxiliary_input_type
Definition: r1cs_gg_ppzksnark/encrypted_input/prover.hpp:56
policy_type::primary_input_type primary_input_type
Definition: r1cs_gg_ppzksnark/encrypted_input/prover.hpp:55
policy_type::proving_key_type proving_key_type
Definition: r1cs_gg_ppzksnark/encrypted_input/prover.hpp:57
Definition: r1cs_gg_ppzksnark/prover.hpp:47
OutputIterator move(const SinglePassRange &rng, OutputIterator result)
Definition: move.hpp:45
boost::mpl::apply< AccumulatorSet, tag::pubkey< ProcessingMode > >::type::result_type pubkey(const AccumulatorSet &acc)
Definition: accumulators/pubkey.hpp:106
ProvingMode
Definition: modes.hpp:33
Definition: pair.hpp:31
Definition: zk/include/nil/crypto3/zk/snark/systems/ppzksnark/r1cs_gg_ppzksnark/detail/basic_policy.hpp:78
Definition: snark/systems/ppzksnark/r1cs_gg_ppzksnark/proof.hpp:40
Definition: systems/ppzksnark/r1cs_gg_ppzksnark/proving_key.hpp:39