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
use ark_ec::{
models::CurveConfig,
short_weierstrass::{self as sw, SWCurveConfig},
};
use ark_ff::{Field, MontFp, Zero};
use crate::{fq::Fq, fr::Fr};
#[cfg(test)]
mod tests;
#[derive(Copy, Clone, Default, PartialEq, Eq)]
pub struct PallasConfig;
impl CurveConfig for PallasConfig {
type BaseField = Fq;
type ScalarField = Fr;
const COFACTOR: &'static [u64] = &[0x1];
const COFACTOR_INV: Fr = Fr::ONE;
}
pub type Affine = sw::Affine<PallasConfig>;
pub type Projective = sw::Projective<PallasConfig>;
impl SWCurveConfig for PallasConfig {
const COEFF_A: Fq = Fq::ZERO;
const COEFF_B: Fq = MontFp!("5");
const GENERATOR: Affine = Affine::new_unchecked(G_GENERATOR_X, G_GENERATOR_Y);
#[inline(always)]
fn mul_by_a(_: Self::BaseField) -> Self::BaseField {
Self::BaseField::zero()
}
}
pub const G_GENERATOR_X: Fq = MontFp!("-1");
pub const G_GENERATOR_Y: Fq = MontFp!("2");