mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-27 14:13:46 +01:00
Upgrade to work with latest ark-ff (#95)
Co-authored-by: Sun <huachuang20@gmail.com>
This commit is contained in:
@@ -1,28 +1,26 @@
|
||||
use ark_ff::{fields::*, MontFp, QuadExt};
|
||||
|
||||
use crate::*;
|
||||
use ark_ff::{field_new, fields::*};
|
||||
|
||||
pub type Fq2 = Fp2<Fq2Parameters>;
|
||||
pub type Fq2 = Fp2<Fq2Config>;
|
||||
|
||||
pub struct Fq2Parameters;
|
||||
pub struct Fq2Config;
|
||||
|
||||
impl Fp2Parameters for Fq2Parameters {
|
||||
impl Fp2Config for Fq2Config {
|
||||
type Fp = Fq;
|
||||
|
||||
/// NONRESIDUE = -1
|
||||
#[rustfmt::skip]
|
||||
const NONRESIDUE: Fq = field_new!(Fq, "-1");
|
||||
const NONRESIDUE: Fq = MontFp!(Fq, "-1");
|
||||
|
||||
/// QUADRATIC_NONRESIDUE = (U + 1)
|
||||
#[rustfmt::skip]
|
||||
const QUADRATIC_NONRESIDUE: (Fq, Fq) = (FQ_ONE, FQ_ONE);
|
||||
const QUADRATIC_NONRESIDUE: Fq2 = QuadExt!(FQ_ONE, FQ_ONE);
|
||||
|
||||
/// Coefficients for the Frobenius automorphism.
|
||||
#[rustfmt::skip]
|
||||
const FROBENIUS_COEFF_FP2_C1: &'static [Fq] = &[
|
||||
// Fq(-1)**(((q^0) - 1) / 2)
|
||||
field_new!(Fq, "1"),
|
||||
MontFp!(Fq, "1"),
|
||||
// Fq(-1)**(((q^1) - 1) / 2)
|
||||
field_new!(Fq, "-1"),
|
||||
MontFp!(Fq, "-1"),
|
||||
];
|
||||
|
||||
#[inline(always)]
|
||||
@@ -31,5 +29,5 @@ impl Fp2Parameters for Fq2Parameters {
|
||||
}
|
||||
}
|
||||
|
||||
pub const FQ2_ZERO: Fq2 = field_new!(Fq2, FQ_ZERO, FQ_ZERO);
|
||||
pub const FQ2_ONE: Fq2 = field_new!(Fq2, FQ_ONE, FQ_ZERO);
|
||||
pub const FQ2_ZERO: Fq2 = QuadExt!(FQ_ZERO, FQ_ZERO);
|
||||
pub const FQ2_ONE: Fq2 = QuadExt!(FQ_ONE, FQ_ZERO);
|
||||
|
||||
Reference in New Issue
Block a user