Upgrade to work with latest ark-ff (#95)

Co-authored-by: Sun <huachuang20@gmail.com>
This commit is contained in:
Pratyush Mishra
2022-03-07 13:12:03 -08:00
committed by GitHub
parent d0dc200f22
commit 1551d6d76c
231 changed files with 2830 additions and 4343 deletions

View File

@@ -1,17 +1,18 @@
use crate::{Fq, Fq2, Fq2Parameters, FQ_ONE, FQ_ZERO};
use ark_ff::{
field_new,
fields::fp4::{Fp4, Fp4Parameters},
fields::fp4::{Fp4, Fp4Config},
MontFp, QuadExt,
};
pub type Fq4 = Fp4<Fq4Parameters>;
use crate::{Fq, Fq2, Fq2Config, FQ_ONE, FQ_ZERO};
pub struct Fq4Parameters;
pub type Fq4 = Fp4<Fq4Config>;
impl Fp4Parameters for Fq4Parameters {
type Fp2Params = Fq2Parameters;
pub struct Fq4Config;
const NONRESIDUE: Fq2 = field_new!(Fq2, FQ_ZERO, FQ_ONE);
impl Fp4Config for Fq4Config {
type Fp2Config = Fq2Config;
const NONRESIDUE: Fq2 = QuadExt!(FQ_ZERO, FQ_ONE);
// Coefficients for the Frobenius automorphism.
// c1[0] = 1,
@@ -19,12 +20,12 @@ impl Fp4Parameters for Fq4Parameters {
// c1[2] = 475922286169261325753349249653048451545124879242694725395555128576210262817955800483758080
// c1[3] = 468238122923807824137727898100575114475823797181717920390930116882062371863914936316755773
//
// These are calculated as `FROBENIUS_COEFF_FP4_C1[i] = Fp2Params::NONRESIDUE^((q^i - 1) / 4)`.
#[rustfmt::skip]
// These are calculated as
// `FROBENIUS_COEFF_FP4_C1[i] = Fp2Config::NONRESIDUE^((q^i - 1) / 4)`.
const FROBENIUS_COEFF_FP4_C1: &'static [Fq] = &[
FQ_ONE,
field_new!(Fq, "7684163245453501615621351552473337069301082060976805004625011694147890954040864167002308"),
field_new!(Fq, "475922286169261325753349249653048451545124879242694725395555128576210262817955800483758080"),
field_new!(Fq, "468238122923807824137727898100575114475823797181717920390930116882062371863914936316755773"),
MontFp!(Fq, "7684163245453501615621351552473337069301082060976805004625011694147890954040864167002308"),
MontFp!(Fq, "475922286169261325753349249653048451545124879242694725395555128576210262817955800483758080"),
MontFp!(Fq, "468238122923807824137727898100575114475823797181717920390930116882062371863914936316755773"),
];
}