Skip to content

Commit

Permalink
Auto merge of #90 - str4d:ff, r=ebfull
Browse files Browse the repository at this point in the history
Use ff crate for traits and impls

Depends on zkcrypto/ff#1 and zkcrypto/ff#5
  • Loading branch information
bmerge committed Jul 5, 2018
2 parents 09b6e6f + fa81037 commit 183a64b
Show file tree
Hide file tree
Showing 18 changed files with 103 additions and 1,902 deletions.
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name = "pairing"

# Remember to change version string in README.md.
version = "0.14.2"
authors = ["Sean Bowe <ewillbefull@gmail.com>"]
authors = [
"Sean Bowe <ewillbefull@gmail.com>",
"Jack Grigg <jack@z.cash>",
]
license = "MIT/Apache-2.0"

description = "Pairing-friendly elliptic curve library"
Expand All @@ -14,10 +17,9 @@ repository = "https://github.com/ebfull/pairing"
[dependencies]
rand = "0.4"
byteorder = "1"
clippy = { version = "0.0.200", optional = true }
ff = { version = "0.4", features = ["derive"] }

[features]
unstable-features = ["expose-arith"]
expose-arith = []
u128-support = []
default = []
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ This is a Rust crate for using pairing-friendly elliptic curves. Currently, only

Bring the `pairing` crate into your project just as you normally would.

If you're using a supported platform and the nightly Rust compiler, you can enable the `u128-support` feature for faster arithmetic.

```toml
[dependencies.pairing]
version = "0.14"
features = ["u128-support"]
```

## Security Warnings

This library does not make any guarantees about constant-time operations, memory access patterns, or resistance to side-channel attacks.
Expand Down
2 changes: 1 addition & 1 deletion benches/bls12_381/fq.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rand::{Rand, SeedableRng, XorShiftRng};

use ff::{Field, PrimeField, PrimeFieldRepr, SqrtField};
use pairing::bls12_381::*;
use pairing::{Field, PrimeField, PrimeFieldRepr, SqrtField};

#[bench]
fn bench_fq_repr_add_nocarry(b: &mut ::test::Bencher) {
Expand Down
2 changes: 1 addition & 1 deletion benches/bls12_381/fq12.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rand::{Rand, SeedableRng, XorShiftRng};

use ff::Field;
use pairing::bls12_381::*;
use pairing::Field;

#[bench]
fn bench_fq12_add_assign(b: &mut ::test::Bencher) {
Expand Down
2 changes: 1 addition & 1 deletion benches/bls12_381/fq2.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rand::{Rand, SeedableRng, XorShiftRng};

use ff::{Field, SqrtField};
use pairing::bls12_381::*;
use pairing::{Field, SqrtField};

#[bench]
fn bench_fq2_add_assign(b: &mut ::test::Bencher) {
Expand Down
2 changes: 1 addition & 1 deletion benches/bls12_381/fr.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rand::{Rand, SeedableRng, XorShiftRng};

use ff::{Field, PrimeField, PrimeFieldRepr, SqrtField};
use pairing::bls12_381::*;
use pairing::{Field, PrimeField, PrimeFieldRepr, SqrtField};

#[bench]
fn bench_fr_repr_add_nocarry(b: &mut ::test::Bencher) {
Expand Down
1 change: 1 addition & 0 deletions benches/pairing_benches.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![feature(test)]

extern crate ff;
extern crate pairing;
extern crate rand;
extern crate test;
Expand Down
12 changes: 4 additions & 8 deletions src/bls12_381/ec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,12 +623,10 @@ macro_rules! curve_impl {
pub mod g1 {
use super::super::{Bls12, Fq, Fq12, FqRepr, Fr, FrRepr};
use super::g2::G2Affine;
use ff::{BitIterator, Field, PrimeField, PrimeFieldRepr, SqrtField};
use rand::{Rand, Rng};
use std::fmt;
use {
BitIterator, CurveAffine, CurveProjective, EncodedPoint, Engine, Field, GroupDecodingError,
PrimeField, PrimeFieldRepr, SqrtField,
};
use {CurveAffine, CurveProjective, EncodedPoint, Engine, GroupDecodingError};

curve_impl!(
"G1",
Expand Down Expand Up @@ -1270,12 +1268,10 @@ pub mod g1 {
pub mod g2 {
use super::super::{Bls12, Fq, Fq12, Fq2, FqRepr, Fr, FrRepr};
use super::g1::G1Affine;
use ff::{BitIterator, Field, PrimeField, PrimeFieldRepr, SqrtField};
use rand::{Rand, Rng};
use std::fmt;
use {
BitIterator, CurveAffine, CurveProjective, EncodedPoint, Engine, Field, GroupDecodingError,
PrimeField, PrimeFieldRepr, SqrtField,
};
use {CurveAffine, CurveProjective, EncodedPoint, Engine, GroupDecodingError};

curve_impl!(
"G2",
Expand Down
Loading

0 comments on commit 183a64b

Please sign in to comment.