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