-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcompression_function_selector.hpp
More file actions
57 lines (49 loc) · 1.82 KB
/
Copy pathcompression_function_selector.hpp
File metadata and controls
57 lines (49 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) 2015-2022 Clearmatics Technologies Ltd
//
// SPDX-License-Identifier: LGPL-3.0+
#include <libff/algebra/curves/bw6_761/bw6_761_pp.hpp>
#include <libff/algebra/curves/mnt/mnt4/mnt4_pp.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_pp.hpp>
#include <libzeth/circuits/circuit_types.hpp>
namespace libzecale
{
/// Used to select a compression function depending on the scalar field of the
/// wrapping pairing-friendly curve.
template<typename wppT> class compression_function_selector
{
public:
/// By default, use the tree_hash_selector from zeth.
using compression_function =
typename libzeth::tree_hash_selector<wppT>::tree_hash;
};
template<> class compression_function_selector<libff::bw6_761_pp>
{
public:
// Constants e=17, r=93 computed via scripts/mimc_constraints.sage in
// http://github.com/clearmatics/zeth.
using compression_function = libzeth::MiMC_mp_gadget<
libff::bw6_761_Fr,
libzeth::MiMC_permutation_gadget<libff::bw6_761_Fr, 17, 93>>;
};
template<> class compression_function_selector<libff::mnt4_pp>
{
public:
// Constants e=17, r=73 computed via scripts/mimc_constraints.sage in
// http://github.com/clearmatics/zeth.
using compression_function = libzeth::MiMC_mp_gadget<
libff::mnt4_Fr,
libzeth::MiMC_permutation_gadget<libff::mnt4_Fr, 17, 73>>;
};
template<> class compression_function_selector<libff::mnt6_pp>
{
public:
// Constants e=17, r=73 computed via scripts/mimc_constraints.sage in
// http://github.com/clearmatics/zeth.
using compression_function = libzeth::MiMC_mp_gadget<
libff::mnt6_Fr,
libzeth::MiMC_permutation_gadget<libff::mnt6_Fr, 17, 73>>;
};
template<typename ppT>
using compression_function_gadget =
typename compression_function_selector<ppT>::compression_function;
} // namespace libzecale