use crate::pasta::*;
use ark_ec::{
models::short_weierstrass::{Affine, Projective, SWCurveConfig},
CurveConfig,
};
use ark_ff::{MontFp, Zero};
pub const G_GENERATOR_X: Fq = MontFp!("1");
pub const G_GENERATOR_Y: Fq =
MontFp!("11426906929455361843568202299992114520848200991084027513389447476559454104162");
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct VestaParameters;
impl CurveConfig for VestaParameters {
type BaseField = Fq;
type ScalarField = Fp;
const COFACTOR: &'static [u64] = &[0x1];
const COFACTOR_INV: Fp = MontFp!("1");
}
pub type Vesta = Affine<VestaParameters>;
pub type ProjectiveVesta = Projective<VestaParameters>;
impl SWCurveConfig for VestaParameters {
const COEFF_A: Fq = MontFp!("0");
const COEFF_B: Fq = MontFp!("5");
const GENERATOR: Affine<Self> = Affine::new_unchecked(G_GENERATOR_X, G_GENERATOR_Y);
}
impl VestaParameters {
#[inline(always)]
pub fn mul_by_a(
_: &<VestaParameters as CurveConfig>::BaseField,
) -> <VestaParameters as CurveConfig>::BaseField {
<VestaParameters as CurveConfig>::BaseField::zero()
}
}
#[derive(Copy, Clone, Default, PartialEq, Eq)]
pub struct LegacyVestaParameters;
impl CurveConfig for LegacyVestaParameters {
type BaseField = <VestaParameters as CurveConfig>::BaseField;
type ScalarField = <VestaParameters as CurveConfig>::ScalarField;
const COFACTOR: &'static [u64] = <VestaParameters as CurveConfig>::COFACTOR;
const COFACTOR_INV: Self::ScalarField = <VestaParameters as CurveConfig>::COFACTOR_INV;
}
impl SWCurveConfig for LegacyVestaParameters {
const COEFF_A: Self::BaseField = <VestaParameters as SWCurveConfig>::COEFF_A;
const COEFF_B: Self::BaseField = <VestaParameters as SWCurveConfig>::COEFF_B;
const GENERATOR: Affine<Self> = Affine::new_unchecked(G_GENERATOR_X, G_GENERATOR_Y);
}
pub type LegacyVesta = Affine<LegacyVestaParameters>;