Change all remaining uses of *Field to reference ff crate
This commit is contained in:
parent
bb22a167af
commit
c49590bab7
@ -1,5 +1,5 @@
|
|||||||
use super::fq2::Fq2;
|
use super::fq2::Fq2;
|
||||||
use {Field, PrimeField, PrimeFieldDecodingError, PrimeFieldRepr};
|
use ff::{Field, PrimeField, PrimeFieldDecodingError, PrimeFieldRepr};
|
||||||
|
|
||||||
// B coefficient of BLS12-381 curve, 4.
|
// B coefficient of BLS12-381 curve, 4.
|
||||||
pub const B_COEFF: Fq = Fq(FqRepr([
|
pub const B_COEFF: Fq = Fq(FqRepr([
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use super::fq::FROBENIUS_COEFF_FQ12_C1;
|
use super::fq::FROBENIUS_COEFF_FQ12_C1;
|
||||||
use super::fq2::Fq2;
|
use super::fq2::Fq2;
|
||||||
use super::fq6::Fq6;
|
use super::fq6::Fq6;
|
||||||
|
use ff::Field;
|
||||||
use rand::{Rand, Rng};
|
use rand::{Rand, Rng};
|
||||||
use Field;
|
|
||||||
|
|
||||||
/// An element of Fq12, represented by c0 + c1 * w.
|
/// An element of Fq12, represented by c0 + c1 * w.
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||||
@ -182,7 +182,7 @@ fn test_fq12_mul_by_014() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fq12_field_tests() {
|
fn fq12_field_tests() {
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
::tests::field::random_field_tests::<Fq12>();
|
::tests::field::random_field_tests::<Fq12>();
|
||||||
::tests::field::random_frobenius_tests::<Fq12, _>(super::fq::Fq::char(), 13);
|
::tests::field::random_frobenius_tests::<Fq12, _>(super::fq::Fq::char(), 13);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::fq::{FROBENIUS_COEFF_FQ2_C1, Fq, NEGATIVE_ONE};
|
use super::fq::{FROBENIUS_COEFF_FQ2_C1, Fq, NEGATIVE_ONE};
|
||||||
|
use ff::{Field, SqrtField};
|
||||||
use rand::{Rand, Rng};
|
use rand::{Rand, Rng};
|
||||||
use {Field, SqrtField};
|
|
||||||
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ fn test_fq2_basics() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_squaring() {
|
fn test_fq2_squaring() {
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::one(),
|
c0: Fq::one(),
|
||||||
@ -346,7 +346,7 @@ fn test_fq2_squaring() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_mul() {
|
fn test_fq2_mul() {
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -410,7 +410,7 @@ fn test_fq2_mul() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_inverse() {
|
fn test_fq2_inverse() {
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
assert!(Fq2::zero().inverse().is_none());
|
assert!(Fq2::zero().inverse().is_none());
|
||||||
|
|
||||||
@ -459,7 +459,7 @@ fn test_fq2_inverse() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_addition() {
|
fn test_fq2_addition() {
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -523,7 +523,7 @@ fn test_fq2_addition() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_subtraction() {
|
fn test_fq2_subtraction() {
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -587,7 +587,7 @@ fn test_fq2_subtraction() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_negation() {
|
fn test_fq2_negation() {
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -634,7 +634,7 @@ fn test_fq2_negation() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_doubling() {
|
fn test_fq2_doubling() {
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -681,7 +681,7 @@ fn test_fq2_doubling() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_frobenius_map() {
|
fn test_fq2_frobenius_map() {
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -794,7 +794,7 @@ fn test_fq2_frobenius_map() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_sqrt() {
|
fn test_fq2_sqrt() {
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Fq2 {
|
Fq2 {
|
||||||
@ -900,7 +900,7 @@ fn test_fq2_mul_nonresidue() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fq2_field_tests() {
|
fn fq2_field_tests() {
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
::tests::field::random_field_tests::<Fq2>();
|
::tests::field::random_field_tests::<Fq2>();
|
||||||
::tests::field::random_sqrt_tests::<Fq2>();
|
::tests::field::random_sqrt_tests::<Fq2>();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::fq::{FROBENIUS_COEFF_FQ6_C1, FROBENIUS_COEFF_FQ6_C2};
|
use super::fq::{FROBENIUS_COEFF_FQ6_C1, FROBENIUS_COEFF_FQ6_C2};
|
||||||
use super::fq2::Fq2;
|
use super::fq2::Fq2;
|
||||||
|
use ff::Field;
|
||||||
use rand::{Rand, Rng};
|
use rand::{Rand, Rng};
|
||||||
use Field;
|
|
||||||
|
|
||||||
/// An element of Fq6, represented by c0 + c1 * v + c2 * v^(2).
|
/// An element of Fq6, represented by c0 + c1 * v + c2 * v^(2).
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||||
@ -367,7 +367,7 @@ fn test_fq6_mul_by_01() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fq6_field_tests() {
|
fn fq6_field_tests() {
|
||||||
use PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
::tests::field::random_field_tests::<Fq6>();
|
::tests::field::random_field_tests::<Fq6>();
|
||||||
::tests::field::random_frobenius_tests::<Fq6, _>(super::fq::Fq::char(), 13);
|
::tests::field::random_frobenius_tests::<Fq6, _>(super::fq::Fq::char(), 13);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
use ff::Field;
|
||||||
use rand::{Rand, Rng, SeedableRng, XorShiftRng};
|
use rand::{Rand, Rng, SeedableRng, XorShiftRng};
|
||||||
|
|
||||||
use {CurveAffine, CurveProjective, EncodedPoint, Field};
|
use {CurveAffine, CurveProjective, EncodedPoint};
|
||||||
|
|
||||||
pub fn curve_tests<G: CurveProjective>() {
|
pub fn curve_tests<G: CurveProjective>() {
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
||||||
@ -66,8 +67,8 @@ pub fn curve_tests<G: CurveProjective>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn random_wnaf_tests<G: CurveProjective>() {
|
fn random_wnaf_tests<G: CurveProjective>() {
|
||||||
|
use ff::PrimeField;
|
||||||
use wnaf::*;
|
use wnaf::*;
|
||||||
use PrimeField;
|
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
use ff::PrimeFieldRepr;
|
||||||
use rand::{SeedableRng, XorShiftRng};
|
use rand::{SeedableRng, XorShiftRng};
|
||||||
use PrimeFieldRepr;
|
|
||||||
|
|
||||||
pub fn random_repr_tests<R: PrimeFieldRepr>() {
|
pub fn random_repr_tests<R: PrimeFieldRepr>() {
|
||||||
random_encoding_tests::<R>();
|
random_encoding_tests::<R>();
|
||||||
|
Loading…
Reference in New Issue
Block a user