Zeth - Zerocash on Ethereum
0.8
Reference implementation of the Zeth protocol by Clearmatics
libzeth
circuits
mimc
mimc_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
#ifndef __ZETH_CIRCUITS_MIMC_MIMC_SELECTOR_HPP__
6
#define __ZETH_CIRCUITS_MIMC_MIMC_SELECTOR_HPP__
7
8
#include "
libzeth/circuits/mimc/mimc_mp.hpp
"
9
10
#include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
11
#include <libff/algebra/curves/bls12_377/bls12_377_pp.hpp>
12
#include <libff/algebra/curves/bw6_761/bw6_761_pp.hpp>
13
#include <libff/algebra/curves/mnt/mnt4/mnt4_pp.hpp>
14
#include <libff/algebra/curves/mnt/mnt6/mnt6_pp.hpp>
15
16
namespace
libzeth
17
{
18
23
template
<
typename
FieldT>
class
mimc_compression_function_selector
;
24
25
// For alt-bn128, use MiMC17 with 65 rounds.
26
template
<>
class
mimc_compression_function_selector
<libff::alt_bn128_Fr>
27
{
28
public
:
29
using
compression_function_gadget
=
MiMC_mp_gadget
<
30
libff::alt_bn128_Fr,
31
MiMC_permutation_gadget<libff::alt_bn128_Fr, 17, 65>
>;
32
};
33
34
// For bls12-377, use MiMC17 with 62 rounds.
35
template
<>
class
mimc_compression_function_selector
<libff::bls12_377_Fr>
36
{
37
public
:
38
using
compression_function_gadget
=
MiMC_mp_gadget
<
39
libff::bls12_377_Fr,
40
MiMC_permutation_gadget<libff::bls12_377_Fr, 17, 62>
>;
41
};
42
43
// For bw6-761, use MiMC17 with 93 rounds.
44
template
<>
class
mimc_compression_function_selector
<libff::bw6_761_Fr>
45
{
46
public
:
47
using
compression_function_gadget
=
libzeth::MiMC_mp_gadget
<
48
libff::bw6_761_Fr,
49
MiMC_permutation_gadget<libff::bw6_761_Fr, 17, 93>
>;
50
};
51
52
// For MNT4, use MiMC17 with 73 rounds.
53
template
<>
class
mimc_compression_function_selector
<libff::mnt4_Fr>
54
{
55
public
:
56
using
compression_function_gadget
=
libzeth::MiMC_mp_gadget
<
57
libff::mnt4_Fr,
58
MiMC_permutation_gadget<libff::mnt4_Fr, 17, 73>
>;
59
};
60
61
// For MNT6, use MiMC17 with 73 rounds.
62
template
<>
class
mimc_compression_function_selector
<libff::mnt6_Fr>
63
{
64
public
:
65
using
compression_function_gadget
=
libzeth::MiMC_mp_gadget
<
66
libff::mnt6_Fr,
67
MiMC_permutation_gadget<libff::mnt6_Fr, 17, 73>
>;
68
};
69
70
template
<
typename
FieldT>
71
using
mimc_compression_function_gadget
=
72
typename
mimc_compression_function_selector
<
73
FieldT>::compression_function_gadget;
74
75
}
// namespace libzeth
76
77
#endif // __ZETH_CIRCUITS_MIMC_MIMC_SELECTOR_HPP__
libzeth
Definition:
binary_operation.hpp:15
libzeth::MiMC_permutation_gadget
Definition:
mimc_permutation.hpp:20
libzeth::mimc_compression_function_selector
Definition:
mimc_selector.hpp:23
mimc_mp.hpp
libzeth::MiMC_mp_gadget
Definition:
mimc_mp.hpp:30
libzeth::mimc_compression_function_gadget
typename mimc_compression_function_selector< FieldT >::compression_function_gadget mimc_compression_function_gadget
Definition:
mimc_selector.hpp:73
Generated on Mon Nov 28 2022 10:29:03 for Zeth - Zerocash on Ethereum by
1.8.17