`QUADRATIC_NONRESIDUE` is never used, remove (#104) * `QUADRATIC_NONRESIDUE` is never used, remove * Update CHANGELOG.md * Remove unused imports
Marcin marcin.gorny.94@protonmail.com
Thu, 30 Jun 2022 20:00:01 +0200
7 files changed,
6 insertions(+),
41 deletions(-)
M
CHANGELOG.md
→
CHANGELOG.md
@@ -7,6 +7,8 @@ - Fixed curve benches
### Breaking changes +- [\#104](https://github.com/arkworks-rs/curves/pull/104) Remove `QUADRATIC_NONRESIDUE` parameter from implementors of `Fp2Config`. + ### Features ### Improvements
M
bls12_377/src/fields/fq2.rs
→
bls12_377/src/fields/fq2.rs
@@ -12,9 +12,6 @@
/// NONRESIDUE = -5 const NONRESIDUE: Fq = MontFp!(Fq, "-5"); - /// QUADRATIC_NONRESIDUE = U - const QUADRATIC_NONRESIDUE: Fq2 = QuadExt!(FQ_ZERO, FQ_ONE); - /// Coefficients for the Frobenius automorphism. const FROBENIUS_COEFF_FP2_C1: &'static [Fq] = &[ // NONRESIDUE**(((q^0) - 1) / 2)
M
bls12_377/src/fields/tests.rs
→
bls12_377/src/fields/tests.rs
@@ -3,7 +3,7 @@ fields::*, generate_field_serialization_test, generate_field_test,
}; use ark_ff::{ biginteger::{BigInt, BigInteger, BigInteger384}, - fields::{FftField, Field, Fp2Config, Fp6Config, PrimeField, SquareRootField}, + fields::{FftField, Field, Fp6Config, PrimeField, SquareRootField}, One, UniformRand, Zero, }; use ark_serialize::{buffer_bit_byte_size, CanonicalSerialize};@@ -13,7 +13,7 @@ cmp::Ordering,
ops::{AddAssign, MulAssign, SubAssign}, }; -use crate::{Fq, Fq12, Fq2, Fq2Config, Fq6, Fq6Config, FqConfig, Fr, FrConfig}; +use crate::{Fq, Fq12, Fq2, Fq6, Fq6Config, FqConfig, Fr, FrConfig}; generate_field_test!(bls12_377; fq2; fq6; fq12; mont(6, 4); ); generate_field_serialization_test!(bls12_377; fq2; fq6; fq12;);@@ -144,26 +144,6 @@ let mut m1 = -Fq2::one();
assert_eq!(QuadraticResidue, m1.legendre()); m1 = Fq6Config::mul_fp2_by_nonresidue(&m1); assert_eq!(QuadraticNonResidue, m1.legendre()); -} - -#[test] -fn test_fq2_mul_nonresidue() { - let mut rng = test_rng(); - - let nqr = Fq2::new(Fq::zero(), Fq::one()); - - let quadratic_non_residue = Fq2::new( - Fq2Config::QUADRATIC_NONRESIDUE.c0, - Fq2Config::QUADRATIC_NONRESIDUE.c1, - ); - for _ in 0..1000 { - let mut a = Fq2::rand(&mut rng); - let mut b = a; - a = quadratic_non_residue * &a; - b.mul_assign(&nqr); - - assert_eq!(a, b); - } } #[test]
M
bls12_381/src/fields/fq2.rs
→
bls12_381/src/fields/fq2.rs
@@ -12,9 +12,6 @@
/// NONRESIDUE = -1 const NONRESIDUE: Fq = MontFp!(Fq, "-1"); - /// QUADRATIC_NONRESIDUE = (U + 1) - const QUADRATIC_NONRESIDUE: Fq2 = QuadExt!(FQ_ONE, FQ_ONE); - /// Coefficients for the Frobenius automorphism. const FROBENIUS_COEFF_FP2_C1: &'static [Fq] = &[ // Fq(-1)**(((q^0) - 1) / 2)
M
bn254/src/fields/fq2.rs
→
bn254/src/fields/fq2.rs
@@ -12,9 +12,6 @@
/// NONRESIDUE = -1 const NONRESIDUE: Fq = MontFp!(Fq, "-1"); - /// QUADRATIC_NONRESIDUE = U+2 - const QUADRATIC_NONRESIDUE: Fq2 = QuadExt!(MontFp!(Fq, "2"), MontFp!(Fq, "1")); - /// Coefficients for the Frobenius automorphism. const FROBENIUS_COEFF_FP2_C1: &'static [Fq] = &[ // NONRESIDUE**(((q^0) - 1) / 2)
M
mnt4_298/src/fields/fq2.rs
→
mnt4_298/src/fields/fq2.rs
@@ -1,6 +1,6 @@
use ark_ff::{ fields::fp2::{Fp2, Fp2Config}, - MontFp, QuadExt, + MontFp, }; use crate::{Fq, FQ_ONE};@@ -15,11 +15,6 @@
/// The quadratic non-residue (17) used to construct the extension is /// the same as that used in [`libff`](https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L102). const NONRESIDUE: Fq = MontFp!(Fq, "17"); - - /// The quadratic non-residue in F<sub>p</sub><sup>2</sup> that is used - /// in the computation of square roots is (8, 1), the same as that in - /// [`libff`](https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L103) - const QUADRATIC_NONRESIDUE: Fq2 = QuadExt!(MontFp!(Fq, "8"), FQ_ONE); /// Precomputed coefficients: /// `[1, 475922286169261325753349249653048451545124879242694725395555128576210262817955800483758080]`
M
mnt4_753/src/fields/fq2.rs
→
mnt4_753/src/fields/fq2.rs
@@ -1,6 +1,6 @@
use ark_ff::{ fields::fp2::{Fp2, Fp2Config}, - MontFp, QuadExt, + MontFp, }; use crate::{Fq, FQ_ONE};@@ -14,9 +14,6 @@ type Fp = Fq;
// non_residue = 13 const NONRESIDUE: Fq = MontFp!(Fq, "13"); - - // qnr = (8, 1) - const QUADRATIC_NONRESIDUE: Fq2 = QuadExt!(MontFp!(Fq, "8"), FQ_ONE); // Coefficients: // [1, 41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689600]