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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#![allow(non_snake_case)]
extern crate rand;
#[macro_use]
extern crate amcl_wrapper;
use amcl_wrapper::extension_field_gt::GT;
#[cfg(all(feature = "VerkeyG1", feature = "VerkeyG2"))]
compile_error!("features `VerkeyG1` and `VerkeyG2` are mutually exclusive");
#[cfg(feature = "VerkeyG2")]
pub type SignatureGroup = amcl_wrapper::group_elem_g1::G1;
#[cfg(feature = "VerkeyG2")]
pub type SignatureGroupVec = amcl_wrapper::group_elem_g1::G1Vector;
#[cfg(feature = "VerkeyG2")]
pub type VerkeyGroup = amcl_wrapper::group_elem_g2::G2;
#[cfg(feature = "VerkeyG2")]
pub type VerkeyGroupVec = amcl_wrapper::group_elem_g2::G2Vector;
#[cfg(feature = "VerkeyG2")]
pub fn ate_2_pairing(
g1: &SignatureGroup,
g2: &VerkeyGroup,
h1: &SignatureGroup,
h2: &VerkeyGroup,
) -> GT {
GT::ate_2_pairing(g1, g2, h1, h2)
}
#[cfg(feature = "VerkeyG2")]
pub fn ate_multi_pairing(elems: Vec<(&SignatureGroup, &VerkeyGroup)>) -> GT {
GT::ate_multi_pairing(elems)
}
#[cfg(feature = "VerkeyG1")]
pub type SignatureGroup = amcl_wrapper::group_elem_g2::G2;
#[cfg(feature = "VerkeyG1")]
pub type SignatureGroupVec = amcl_wrapper::group_elem_g2::G2Vector;
#[cfg(feature = "VerkeyG1")]
pub type VerkeyGroup = amcl_wrapper::group_elem_g1::G1;
#[cfg(feature = "VerkeyG1")]
pub type VerkeyGroupVec = amcl_wrapper::group_elem_g1::G1Vector;
#[cfg(feature = "VerkeyG1")]
pub fn ate_2_pairing(
g1: &SignatureGroup,
g2: &VerkeyGroup,
h1: &SignatureGroup,
h2: &VerkeyGroup,
) -> GT {
GT::ate_2_pairing(g2, g1, h2, h1)
}
#[cfg(feature = "VerkeyG1")]
pub fn ate_multi_pairing(elems: Vec<(&SignatureGroup, &VerkeyGroup)>) -> GT {
GT::ate_multi_pairing(
elems
.into_iter()
.map(|(s, v)| (v, s))
.collect::<Vec<(&VerkeyGroup, &SignatureGroup)>>(),
)
}
#[macro_use]
extern crate failure;
extern crate serde;
#[macro_use]
extern crate serde_derive;
pub mod errors;
pub mod keys;
pub mod signature;
pub mod util;
pub mod threshold_sig;