mina_curves/pasta/curves/
pallas.rs1use crate::pasta::*;
2use ark_ec::{
3 models::short_weierstrass::{Affine, Projective, SWCurveConfig},
4 CurveConfig,
5};
6use ark_ff::{MontFp, Zero};
7
8pub const G_GENERATOR_X: Fp = MontFp!("1");
11
12pub const G_GENERATOR_Y: Fp =
15 MontFp!("12418654782883325593414442427049395787963493412651469444558597405572177144507");
16
17#[derive(Debug, Clone, Default, PartialEq, Eq)]
18pub struct PallasParameters;
19
20impl CurveConfig for PallasParameters {
21 type BaseField = Fp;
22
23 type ScalarField = Fq;
24
25 const COFACTOR: &'static [u64] = &[0x1];
27
28 const COFACTOR_INV: Fq = MontFp!("1");
30}
31
32pub type Pallas = Affine<PallasParameters>;
33
34pub type ProjectivePallas = Projective<PallasParameters>;
35
36impl SWCurveConfig for PallasParameters {
37 const COEFF_A: Self::BaseField = MontFp!("0");
38
39 const COEFF_B: Self::BaseField = MontFp!("5");
40
41 const GENERATOR: Affine<Self> = Affine::new_unchecked(G_GENERATOR_X, G_GENERATOR_Y);
42}
43
44impl PallasParameters {
45 #[inline(always)]
46 pub fn mul_by_a(
47 _: &<PallasParameters as CurveConfig>::BaseField,
48 ) -> <PallasParameters as CurveConfig>::BaseField {
49 <PallasParameters as CurveConfig>::BaseField::zero()
50 }
51}
52
53#[derive(Copy, Clone, Default, PartialEq, Eq)]
55pub struct LegacyPallasParameters;
56
57impl CurveConfig for LegacyPallasParameters {
58 type BaseField = <PallasParameters as CurveConfig>::BaseField;
59
60 type ScalarField = <PallasParameters as CurveConfig>::ScalarField;
61
62 const COFACTOR: &'static [u64] = <PallasParameters as CurveConfig>::COFACTOR;
63
64 const COFACTOR_INV: Self::ScalarField = <PallasParameters as CurveConfig>::COFACTOR_INV;
65}
66
67impl SWCurveConfig for LegacyPallasParameters {
68 const COEFF_A: Self::BaseField = <PallasParameters as SWCurveConfig>::COEFF_A;
69
70 const COEFF_B: Self::BaseField = <PallasParameters as SWCurveConfig>::COEFF_B;
71
72 const GENERATOR: Affine<Self> = Affine::new_unchecked(G_GENERATOR_X, G_GENERATOR_Y);
73}
74
75pub type LegacyPallas = Affine<LegacyPallasParameters>;