Migrate to ff 0.4
This commit is contained in:
parent
4752a91781
commit
c5b883f91e
@ -17,10 +17,9 @@ repository = "https://github.com/ebfull/pairing"
|
||||
[dependencies]
|
||||
rand = "0.4"
|
||||
byteorder = "1"
|
||||
ff = "0.3"
|
||||
ff = { version = "0.4", features = ["derive"] }
|
||||
|
||||
[features]
|
||||
unstable-features = ["expose-arith"]
|
||||
expose-arith = []
|
||||
u128-support = ["ff/u128-support"]
|
||||
default = []
|
||||
|
@ -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.
|
||||
|
@ -20,7 +20,7 @@ pub use self::fr::{Fr, FrRepr};
|
||||
|
||||
use super::{CurveAffine, Engine};
|
||||
|
||||
use ff::{BitIterator, Field};
|
||||
use ff::{BitIterator, Field, ScalarEngine};
|
||||
|
||||
// The BLS parameter x for BLS12-381 is -0xd201000000010000
|
||||
const BLS_X: u64 = 0xd201000000010000;
|
||||
@ -29,8 +29,11 @@ const BLS_X_IS_NEGATIVE: bool = true;
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Bls12;
|
||||
|
||||
impl Engine for Bls12 {
|
||||
impl ScalarEngine for Bls12 {
|
||||
type Fr = Fr;
|
||||
}
|
||||
|
||||
impl Engine for Bls12 {
|
||||
type G1 = G1;
|
||||
type G1Affine = G1Affine;
|
||||
type G2 = G2;
|
||||
|
@ -25,17 +25,14 @@ pub mod bls12_381;
|
||||
mod wnaf;
|
||||
pub use self::wnaf::Wnaf;
|
||||
|
||||
use ff::{Field, PrimeField, PrimeFieldDecodingError, PrimeFieldRepr, SqrtField};
|
||||
use ff::{Field, PrimeField, PrimeFieldDecodingError, PrimeFieldRepr, ScalarEngine, SqrtField};
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
|
||||
/// An "engine" is a collection of types (fields, elliptic curve groups, etc.)
|
||||
/// with well-defined relationships. In particular, the G1/G2 curve groups are
|
||||
/// of prime order `r`, and are equipped with a bilinear pairing function.
|
||||
pub trait Engine: Sized + 'static + Clone {
|
||||
/// This is the scalar field of the G1/G2 groups.
|
||||
type Fr: PrimeField + SqrtField;
|
||||
|
||||
pub trait Engine: ScalarEngine {
|
||||
/// The projective representation of an element in G1.
|
||||
type G1: CurveProjective<
|
||||
Engine = Self,
|
||||
|
Loading…
Reference in New Issue
Block a user