mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-12 00:41:32 +01:00
Catch up with algebra (#106)
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use ark_ff::{
|
||||
fields::fp3::{Fp3, Fp3Config},
|
||||
CubicExt, MontFp,
|
||||
Field, MontFp,
|
||||
};
|
||||
|
||||
use crate::{fq::Fq, FQ_ONE, FQ_ZERO};
|
||||
use crate::fq::Fq;
|
||||
|
||||
pub type Fq3 = Fp3<Fq3Config>;
|
||||
|
||||
@@ -12,7 +12,7 @@ pub struct Fq3Config;
|
||||
impl Fp3Config for Fq3Config {
|
||||
type Fp = Fq;
|
||||
|
||||
const NONRESIDUE: Fq = MontFp!(Fq, "11");
|
||||
const NONRESIDUE: Fq = MontFp!("11");
|
||||
|
||||
const TWO_ADICITY: u32 = 30;
|
||||
|
||||
@@ -56,10 +56,10 @@ impl Fp3Config for Fq3Config {
|
||||
];
|
||||
|
||||
/// (11^T, 0, 0)
|
||||
const QUADRATIC_NONRESIDUE_TO_T: Fq3 = CubicExt!(
|
||||
MontFp!(Fq, "22168644070733283197994897338612733221095941481265408161807376791727499343083607817089033595478370212662133368413166734396127674284827734481031659015434501966360165723728649019457855887066657739809176476252080335185730833468062"),
|
||||
FQ_ZERO,
|
||||
FQ_ZERO,
|
||||
const QUADRATIC_NONRESIDUE_TO_T: Fq3 = Fq3::new(
|
||||
MontFp!("22168644070733283197994897338612733221095941481265408161807376791727499343083607817089033595478370212662133368413166734396127674284827734481031659015434501966360165723728649019457855887066657739809176476252080335185730833468062"),
|
||||
Fq::ZERO,
|
||||
Fq::ZERO,
|
||||
);
|
||||
|
||||
// Coefficients for the Frobenius automorphism.
|
||||
@@ -67,14 +67,14 @@ impl Fp3Config for Fq3Config {
|
||||
// c1[1] = 24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132
|
||||
// c1[2] = 17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868,
|
||||
const FROBENIUS_COEFF_FP3_C1: &'static [Fq] = &[
|
||||
FQ_ONE,
|
||||
MontFp!(Fq, "24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132"),
|
||||
MontFp!(Fq, "17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868"),
|
||||
Fq::ONE,
|
||||
MontFp!("24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132"),
|
||||
MontFp!("17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868"),
|
||||
];
|
||||
|
||||
// c2 = {c1[0], c1[2], c1[1]}
|
||||
const FROBENIUS_COEFF_FP3_C2: &'static [Fq] = &[
|
||||
FQ_ONE,
|
||||
Fq::ONE,
|
||||
Self::FROBENIUS_COEFF_FP3_C1[2],
|
||||
Self::FROBENIUS_COEFF_FP3_C1[1],
|
||||
];
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use ark_ff::{
|
||||
fields::fp6_2over3::{Fp6, Fp6Config},
|
||||
CubicExt, MontFp,
|
||||
Field, MontFp,
|
||||
};
|
||||
|
||||
use crate::{Fq, Fq3, Fq3Config, FQ_ONE, FQ_ZERO};
|
||||
use crate::{Fq, Fq3, Fq3Config};
|
||||
|
||||
pub type Fq6 = Fp6<Fq6Config>;
|
||||
|
||||
@@ -12,7 +12,7 @@ pub struct Fq6Config;
|
||||
impl Fp6Config for Fq6Config {
|
||||
type Fp3Config = Fq3Config;
|
||||
|
||||
const NONRESIDUE: Fq3 = CubicExt!(FQ_ZERO, FQ_ONE, FQ_ZERO);
|
||||
const NONRESIDUE: Fq3 = Fq3::new(Fq::ZERO, Fq::ONE, Fq::ZERO);
|
||||
|
||||
// Coefficients for the Frobenius automorphism.
|
||||
// c1[0] = 1,
|
||||
@@ -22,11 +22,11 @@ impl Fp6Config for Fq6Config {
|
||||
// c1[4] = 17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868
|
||||
// c1[5] = 17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107869
|
||||
const FROBENIUS_COEFF_FP6_C1: &'static [Fq] = &[
|
||||
FQ_ONE,
|
||||
MontFp!(Fq, "24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052133"),
|
||||
MontFp!(Fq, "24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132"),
|
||||
MontFp!(Fq, "41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888458477323173057491593855069696241854796396165721416325350064441470418137846398469611935719059908164220784476160000"),
|
||||
MontFp!(Fq, "17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868"),
|
||||
MontFp!(Fq, "17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107869"),
|
||||
Fq::ONE,
|
||||
MontFp!("24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052133"),
|
||||
MontFp!("24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132"),
|
||||
MontFp!("41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888458477323173057491593855069696241854796396165721416325350064441470418137846398469611935719059908164220784476160000"),
|
||||
MontFp!("17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868"),
|
||||
MontFp!("17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107869"),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ use ark_algebra_test_templates::{
|
||||
fields::*, generate_field_serialization_test, generate_field_test,
|
||||
};
|
||||
use ark_ff::{
|
||||
fields::{models::fp6_2over3::*, quadratic_extension::QuadExtConfig, SquareRootField},
|
||||
fields::{models::fp6_2over3::*, quadratic_extension::QuadExtConfig},
|
||||
Field, PrimeField,
|
||||
};
|
||||
use ark_serialize::{buffer_bit_byte_size, CanonicalSerialize};
|
||||
@@ -11,7 +11,7 @@ use core::ops::{AddAssign, MulAssign, SubAssign};
|
||||
|
||||
use crate::*;
|
||||
|
||||
generate_field_test!(mnt6_753; fq3; fq6; mont(12, 12); );
|
||||
generate_field_test!(mnt6_753; fq3; fq6_2_on_3; mont(12, 12); );
|
||||
generate_field_serialization_test!(mnt6_753;);
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user