Files
ark-curves-cherry-picked/bn254/src/fields/fq2.rs
Marcin 93e64df895 Catch up with algebra (#106)
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
2022-07-29 12:16:16 -07:00

28 lines
559 B
Rust

use ark_ff::{fields::*, MontFp};
use crate::*;
pub type Fq2 = Fp2<Fq2Config>;
pub struct Fq2Config;
impl Fp2Config for Fq2Config {
type Fp = Fq;
/// NONRESIDUE = -1
const NONRESIDUE: Fq = MontFp!("-1");
/// Coefficients for the Frobenius automorphism.
const FROBENIUS_COEFF_FP2_C1: &'static [Fq] = &[
// NONRESIDUE**(((q^0) - 1) / 2)
Fq::ONE,
// NONRESIDUE**(((q^1) - 1) / 2)
MontFp!("-1"),
];
#[inline(always)]
fn mul_fp_by_nonresidue(fe: &Self::Fp) -> Self::Fp {
-(*fe)
}
}