Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratyush committed Dec 9, 2020
1 parent 270b14b commit 11c933e
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 35 deletions.
9 changes: 5 additions & 4 deletions bls12_377/src/curves/g1.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use ark_ec::models::{ModelParameters, SWModelParameters};
use ark_ff::{
field_new, Zero,
};
use ark_ff::{field_new, Zero};

use crate::{Fq, Fr, fields::{FQ_ZERO, FQ_ONE}};
use crate::{
fields::{FQ_ONE, FQ_ZERO},
Fq, Fr,
};

#[derive(Clone, Default, PartialEq, Eq)]
pub struct Parameters;
Expand Down
6 changes: 2 additions & 4 deletions bls12_377/src/curves/g2.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use ark_ec::models::{ModelParameters, SWModelParameters};
use ark_ff::{
field_new, Zero,
};
use ark_ff::{field_new, Zero};

use crate::{g1, Fq, Fq2, Fr, fields::FQ_ZERO};
use crate::{fields::FQ_ZERO, g1, Fq, Fq2, Fr};

#[derive(Clone, Default, PartialEq, Eq)]
pub struct Parameters;
Expand Down
20 changes: 16 additions & 4 deletions bn254/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,25 @@ impl BnParameters for Parameters {

const TWIST_MUL_BY_Q_X: Fq2 = field_new!(
Fq2,
field_new!(Fq, "21575463638280843010398324269430826099269044274347216827212613867836435027261"),
field_new!(Fq, "10307601595873709700152284273816112264069230130616436755625194854815875713954"),
field_new!(
Fq,
"21575463638280843010398324269430826099269044274347216827212613867836435027261"
),
field_new!(
Fq,
"10307601595873709700152284273816112264069230130616436755625194854815875713954"
),
);
const TWIST_MUL_BY_Q_Y: Fq2 = field_new!(
Fq2,
field_new!(Fq, "2821565182194536844548159561693502659359617185244120367078079554186484126554"),
field_new!(Fq, "3505843767911556378687030309984248845540243509899259641013678093033130930403"),
field_new!(
Fq,
"2821565182194536844548159561693502659359617185244120367078079554186484126554"
),
field_new!(
Fq,
"3505843767911556378687030309984248845540243509899259641013678093033130930403"
),
);
const TWIST_TYPE: TwistType = TwistType::D;
type Fp = Fq;
Expand Down
5 changes: 4 additions & 1 deletion bw6_761/src/fields/fq3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use ark_ff::{
fields::fp3::{Fp3, Fp3Parameters},
};

use crate::{Fq, fields::{FQ_ZERO, FQ_ONE}};
use crate::{
fields::{FQ_ONE, FQ_ZERO},
Fq,
};

pub type Fq3 = Fp3<Fq3Parameters>;

Expand Down
2 changes: 1 addition & 1 deletion curve-tests/src/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ pub fn frobenius_test<F: Field, C: AsRef<[u64]>>(characteristic: C, maxpower: us
for power in 1..maxpower {
let mut a_qi = a;
a_qi.frobenius_map(power);
assert_eq!(a_qi, a_q);
assert_eq!(a_qi, a_q, "failed on power {}", power);

a_q = a_q.pow(&characteristic);
}
Expand Down
2 changes: 0 additions & 2 deletions ed_on_bn254/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ mod tests;
pub type EdwardsAffine = GroupAffine<EdwardsParameters>;
pub type EdwardsProjective = GroupProjective<EdwardsParameters>;



/// `Baby-JubJub` is a twisted Edwards curve. These curves have equations of the
/// form: ax² + y² = 1 + dx²y².
/// over some base finite field Fq.
Expand Down
2 changes: 1 addition & 1 deletion ed_on_cp6_782/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
models::{ModelParameters, MontgomeryModelParameters, TEModelParameters},
twisted_edwards_extended::{GroupAffine, GroupProjective},
};
use ark_ff::{field_new};
use ark_ff::field_new;

use crate::{fq::Fq, fr::Fr};

Expand Down
2 changes: 1 addition & 1 deletion ed_on_mnt4_298/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
models::{ModelParameters, MontgomeryModelParameters, TEModelParameters},
twisted_edwards_extended::{GroupAffine, GroupProjective},
};
use ark_ff::{field_new};
use ark_ff::field_new;

use crate::{fq::Fq, fr::Fr};

Expand Down
2 changes: 1 addition & 1 deletion mnt4_298/src/curves/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ark_ec::{
mnt4,
models::{ModelParameters, SWModelParameters},
};
use ark_ff::{field_new};
use ark_ff::field_new;

pub type G1Affine = mnt4::G1Affine<crate::Parameters>;
pub type G1Projective = mnt4::G1Projective<crate::Parameters>;
Expand Down
5 changes: 1 addition & 4 deletions mnt4_298/src/fields/fq2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ impl Fp2Parameters for Fq2Parameters {
/// 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: (Self::Fp, Self::Fp) = (
field_new!(Fq, "8"),
FQ_ONE,
);
const QUADRATIC_NONRESIDUE: (Self::Fp, Self::Fp) = (field_new!(Fq, "8"), FQ_ONE);

/// Precomputed coefficients:
/// `[1, 475922286169261325753349249653048451545124879242694725395555128576210262817955800483758080]`
Expand Down
2 changes: 1 addition & 1 deletion mnt6_298/src/curves/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
mnt6,
models::{ModelParameters, SWModelParameters},
};
use ark_ff::{field_new};
use ark_ff::field_new;

use crate::{Fq, Fr};

Expand Down
32 changes: 25 additions & 7 deletions mnt6_298/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ark_ec::{
mnt6::MNT6Parameters,
models::{ModelParameters, SWModelParameters},
};
use ark_ff::{field_new};
use ark_ff::field_new;

use crate::{g1, Fq, Fq3, Fr, FQ_ZERO};

Expand Down Expand Up @@ -81,10 +81,28 @@ const G2_GENERATOR_X: Fq3 =
const G2_GENERATOR_Y: Fq3 =
field_new!(Fq3, G2_GENERATOR_Y_C0, G2_GENERATOR_Y_C1, G2_GENERATOR_Y_C2);

pub const G2_GENERATOR_X_C0: Fq = field_new!(Fq, "421456435772811846256826561593908322288509115489119907560382401870203318738334702321297427");
pub const G2_GENERATOR_X_C1: Fq = field_new!(Fq, "103072927438548502463527009961344915021167584706439945404959058962657261178393635706405114");
pub const G2_GENERATOR_X_C2: Fq = field_new!(Fq, "143029172143731852627002926324735183809768363301149009204849580478324784395590388826052558");
pub const G2_GENERATOR_X_C0: Fq = field_new!(
Fq,
"421456435772811846256826561593908322288509115489119907560382401870203318738334702321297427"
);
pub const G2_GENERATOR_X_C1: Fq = field_new!(
Fq,
"103072927438548502463527009961344915021167584706439945404959058962657261178393635706405114"
);
pub const G2_GENERATOR_X_C2: Fq = field_new!(
Fq,
"143029172143731852627002926324735183809768363301149009204849580478324784395590388826052558"
);

pub const G2_GENERATOR_Y_C0: Fq = field_new!(Fq, "464673596668689463130099227575639512541218133445388869383893594087634649237515554342751377");
pub const G2_GENERATOR_Y_C1: Fq = field_new!(Fq, "100642907501977375184575075967118071807821117960152743335603284583254620685343989304941678");
pub const G2_GENERATOR_Y_C2: Fq = field_new!(Fq, "123019855502969896026940545715841181300275180157288044663051565390506010149881373807142903");
pub const G2_GENERATOR_Y_C0: Fq = field_new!(
Fq,
"464673596668689463130099227575639512541218133445388869383893594087634649237515554342751377"
);
pub const G2_GENERATOR_Y_C1: Fq = field_new!(
Fq,
"100642907501977375184575075967118071807821117960152743335603284583254620685343989304941678"
);
pub const G2_GENERATOR_Y_C2: Fq = field_new!(
Fq,
"123019855502969896026940545715841181300275180157288044663051565390506010149881373807142903"
);
5 changes: 4 additions & 1 deletion mnt6_298/src/curves/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use ark_ff::{biginteger::BigInteger320, field_new, Fp3};

use ark_ec::{models::mnt6::{MNT6Parameters, MNT6}, SWModelParameters};
use ark_ec::{
models::mnt6::{MNT6Parameters, MNT6},
SWModelParameters,
};

use crate::{Fq, Fq3, Fq3Parameters, Fq6Parameters, Fr};

Expand Down
2 changes: 1 addition & 1 deletion mnt6_753/src/curves/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
mnt6,
models::{ModelParameters, SWModelParameters},
};
use ark_ff::{field_new};
use ark_ff::field_new;

use crate::{Fq, Fr, FR_ONE};

Expand Down
2 changes: 1 addition & 1 deletion mnt6_753/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ark_ec::{
mnt6::MNT6Parameters,
models::{ModelParameters, SWModelParameters},
};
use ark_ff::{field_new};
use ark_ff::field_new;

use crate::{g1, Fq, Fq3, Fr, FQ_ZERO};

Expand Down
2 changes: 1 addition & 1 deletion mnt6_753/src/curves/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use ark_ff::{biginteger::BigInteger768, field_new, Fp3};
use ark_ec::models::{
mnt6::{MNT6Parameters, MNT6},
SWModelParameters,
};
use ark_ff::{biginteger::BigInteger768, field_new, Fp3};

use crate::{Fq, Fq3, Fq3Parameters, Fq6Parameters, Fr};

Expand Down

0 comments on commit 11c933e

Please sign in to comment.