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
use super::{
algebra::Group,
comp::{Basic, ParityCmp},
field::PrimeField,
};
pub trait Curve: ParityCmp + Basic + Group {
type Range: PrimeField;
const PARAM_A: Self::Range;
const PARAM_B: Self::Range;
fn is_identity(self) -> bool;
fn double(self) -> Self;
fn is_on_curve(self) -> bool;
}
pub trait Affine: Curve + Into<Self::Projective> + From<Self::Projective> {
type Projective: Projective;
fn to_projective(self) -> Self::Projective;
}
pub trait Projective: Curve + Into<Self::Affine> + From<Self::Affine> {
type Affine: Affine;
fn to_affine(self) -> Self::Affine;
fn get_x(&self) -> Self::Range;
fn get_y(&self) -> Self::Range;
fn get_z(&self) -> Self::Range;
fn set_x(&mut self, value: Self::Range);
fn set_y(&mut self, value: Self::Range);
fn set_z(&mut self, value: Self::Range);
}