Skip to content

Commit 183a64b

Browse files
committed
Auto merge of #90 - str4d:ff, r=ebfull
Use ff crate for traits and impls Depends on https://github.com/ebfull/ff/pull/1 and https://github.com/ebfull/ff/pull/5
2 parents 09b6e6f + fa81037 commit 183a64b

18 files changed

Lines changed: 103 additions & 1902 deletions

File tree

Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ name = "pairing"
33

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

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

1922
[features]
2023
unstable-features = ["expose-arith"]
2124
expose-arith = []
22-
u128-support = []
2325
default = []

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ This is a Rust crate for using pairing-friendly elliptic curves. Currently, only
66

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

9-
If you're using a supported platform and the nightly Rust compiler, you can enable the `u128-support` feature for faster arithmetic.
10-
11-
```toml
12-
[dependencies.pairing]
13-
version = "0.14"
14-
features = ["u128-support"]
15-
```
16-
179
## Security Warnings
1810

1911
This library does not make any guarantees about constant-time operations, memory access patterns, or resistance to side-channel attacks.

benches/bls12_381/fq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rand::{Rand, SeedableRng, XorShiftRng};
22

3+
use ff::{Field, PrimeField, PrimeFieldRepr, SqrtField};
34
use pairing::bls12_381::*;
4-
use pairing::{Field, PrimeField, PrimeFieldRepr, SqrtField};
55

66
#[bench]
77
fn bench_fq_repr_add_nocarry(b: &mut ::test::Bencher) {

benches/bls12_381/fq12.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rand::{Rand, SeedableRng, XorShiftRng};
22

3+
use ff::Field;
34
use pairing::bls12_381::*;
4-
use pairing::Field;
55

66
#[bench]
77
fn bench_fq12_add_assign(b: &mut ::test::Bencher) {

benches/bls12_381/fq2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rand::{Rand, SeedableRng, XorShiftRng};
22

3+
use ff::{Field, SqrtField};
34
use pairing::bls12_381::*;
4-
use pairing::{Field, SqrtField};
55

66
#[bench]
77
fn bench_fq2_add_assign(b: &mut ::test::Bencher) {

benches/bls12_381/fr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rand::{Rand, SeedableRng, XorShiftRng};
22

3+
use ff::{Field, PrimeField, PrimeFieldRepr, SqrtField};
34
use pairing::bls12_381::*;
4-
use pairing::{Field, PrimeField, PrimeFieldRepr, SqrtField};
55

66
#[bench]
77
fn bench_fr_repr_add_nocarry(b: &mut ::test::Bencher) {

benches/pairing_benches.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![feature(test)]
22

3+
extern crate ff;
34
extern crate pairing;
45
extern crate rand;
56
extern crate test;

src/bls12_381/ec.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -623,12 +623,10 @@ macro_rules! curve_impl {
623623
pub mod g1 {
624624
use super::super::{Bls12, Fq, Fq12, FqRepr, Fr, FrRepr};
625625
use super::g2::G2Affine;
626+
use ff::{BitIterator, Field, PrimeField, PrimeFieldRepr, SqrtField};
626627
use rand::{Rand, Rng};
627628
use std::fmt;
628-
use {
629-
BitIterator, CurveAffine, CurveProjective, EncodedPoint, Engine, Field, GroupDecodingError,
630-
PrimeField, PrimeFieldRepr, SqrtField,
631-
};
629+
use {CurveAffine, CurveProjective, EncodedPoint, Engine, GroupDecodingError};
632630

633631
curve_impl!(
634632
"G1",
@@ -1270,12 +1268,10 @@ pub mod g1 {
12701268
pub mod g2 {
12711269
use super::super::{Bls12, Fq, Fq12, Fq2, FqRepr, Fr, FrRepr};
12721270
use super::g1::G1Affine;
1271+
use ff::{BitIterator, Field, PrimeField, PrimeFieldRepr, SqrtField};
12731272
use rand::{Rand, Rng};
12741273
use std::fmt;
1275-
use {
1276-
BitIterator, CurveAffine, CurveProjective, EncodedPoint, Engine, Field, GroupDecodingError,
1277-
PrimeField, PrimeFieldRepr, SqrtField,
1278-
};
1274+
use {CurveAffine, CurveProjective, EncodedPoint, Engine, GroupDecodingError};
12791275

12801276
curve_impl!(
12811277
"G2",

0 commit comments

Comments
 (0)