Zecale - Reconciling Privacy and Scalability on Smart-Contract Chains  0.5
Reference implementation of the Zecale protocol by Clearmatics
compression_function_selector.hpp
Go to the documentation of this file.
1 // Copyright (c) 2015-2022 Clearmatics Technologies Ltd
2 //
3 // SPDX-License-Identifier: LGPL-3.0+
4 
5 #include <libff/algebra/curves/bw6_761/bw6_761_pp.hpp>
6 #include <libff/algebra/curves/mnt/mnt4/mnt4_pp.hpp>
7 #include <libff/algebra/curves/mnt/mnt6/mnt6_pp.hpp>
8 #include <libzeth/circuits/circuit_types.hpp>
9 
10 namespace libzecale
11 {
12 
15 template<typename wppT> class compression_function_selector
16 {
17 public:
19  using compression_function =
20  typename libzeth::tree_hash_selector<wppT>::tree_hash;
21 };
22 
23 template<> class compression_function_selector<libff::bw6_761_pp>
24 {
25 public:
26  // Constants e=17, r=93 computed via scripts/mimc_constraints.sage in
27  // http://github.com/clearmatics/zeth.
28  using compression_function = libzeth::MiMC_mp_gadget<
29  libff::bw6_761_Fr,
30  libzeth::MiMC_permutation_gadget<libff::bw6_761_Fr, 17, 93>>;
31 };
32 
33 template<> class compression_function_selector<libff::mnt4_pp>
34 {
35 public:
36  // Constants e=17, r=73 computed via scripts/mimc_constraints.sage in
37  // http://github.com/clearmatics/zeth.
38  using compression_function = libzeth::MiMC_mp_gadget<
39  libff::mnt4_Fr,
40  libzeth::MiMC_permutation_gadget<libff::mnt4_Fr, 17, 73>>;
41 };
42 
43 template<> class compression_function_selector<libff::mnt6_pp>
44 {
45 public:
46  // Constants e=17, r=73 computed via scripts/mimc_constraints.sage in
47  // http://github.com/clearmatics/zeth.
48  using compression_function = libzeth::MiMC_mp_gadget<
49  libff::mnt6_Fr,
50  libzeth::MiMC_permutation_gadget<libff::mnt6_Fr, 17, 73>>;
51 };
52 
53 template<typename ppT>
56 
57 } // namespace libzecale
libzecale::compression_function_selector< libff::mnt4_pp >::compression_function
libzeth::MiMC_mp_gadget< libff::mnt4_Fr, libzeth::MiMC_permutation_gadget< libff::mnt4_Fr, 17, 73 > > compression_function
Definition: compression_function_selector.hpp:40
libzecale::compression_function_selector::compression_function
typename libzeth::tree_hash_selector< wppT >::tree_hash compression_function
By default, use the tree_hash_selector from zeth.
Definition: compression_function_selector.hpp:20
libzecale::compression_function_selector< libff::bw6_761_pp >::compression_function
libzeth::MiMC_mp_gadget< libff::bw6_761_Fr, libzeth::MiMC_permutation_gadget< libff::bw6_761_Fr, 17, 93 > > compression_function
Definition: compression_function_selector.hpp:30
libzecale::compression_function_selector< libff::mnt6_pp >::compression_function
libzeth::MiMC_mp_gadget< libff::mnt6_Fr, libzeth::MiMC_permutation_gadget< libff::mnt6_Fr, 17, 73 > > compression_function
Definition: compression_function_selector.hpp:50
libzecale::compression_function_selector
Definition: compression_function_selector.hpp:15
libzecale
Definition: aggregator_circuit.hpp:15
libzecale::compression_function_gadget
typename compression_function_selector< ppT >::compression_function compression_function_gadget
Definition: compression_function_selector.hpp:55