Auto merge of #79 - ebfull:nomorenightly, r=ebfull
Remove feature(i128_type) The `i128_type` feature was recently stabilized in Rust, so this is unnecessary now for nightly users. In fact, in a few days there should be a new Rust beta (`1.26`) containing stable support for `i128_type`, meaning that (for Zcash) we can switch to the beta compiler for all future Rust development, and even switch to the stable compiler in six weeks when that's released.
This commit is contained in:
commit
dbe897d365
@ -2,7 +2,7 @@
|
|||||||
name = "pairing"
|
name = "pairing"
|
||||||
|
|
||||||
# Remember to change version string in README.md.
|
# Remember to change version string in README.md.
|
||||||
version = "0.14.0"
|
version = "0.14.1"
|
||||||
authors = ["Sean Bowe <ewillbefull@gmail.com>"]
|
authors = ["Sean Bowe <ewillbefull@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ repository = "https://github.com/ebfull/pairing"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
rand = "0.4"
|
rand = "0.4"
|
||||||
byteorder = "1"
|
byteorder = "1"
|
||||||
clippy = { version = "0.0.186", optional = true }
|
clippy = { version = "0.0.190", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
unstable-features = ["expose-arith"]
|
unstable-features = ["expose-arith"]
|
||||||
|
@ -2135,8 +2135,7 @@ fn test_fq_repr_sub_noborrow() {
|
|||||||
0x7c0577a26f59d5,
|
0x7c0577a26f59d5,
|
||||||
]));
|
]));
|
||||||
assert!(
|
assert!(
|
||||||
t
|
t == FqRepr([
|
||||||
== FqRepr([
|
|
||||||
0x40a12b8967c54bae,
|
0x40a12b8967c54bae,
|
||||||
0xdeae37a0837d0d7b,
|
0xdeae37a0837d0d7b,
|
||||||
0xe592c487bae374e,
|
0xe592c487bae374e,
|
||||||
@ -2223,8 +2222,7 @@ fn test_fq_repr_add_nocarry() {
|
|||||||
0x7c0577a26f59d5,
|
0x7c0577a26f59d5,
|
||||||
]));
|
]));
|
||||||
assert!(
|
assert!(
|
||||||
t
|
t == FqRepr([
|
||||||
== FqRepr([
|
|
||||||
0xcfae1db798be8c04,
|
0xcfae1db798be8c04,
|
||||||
0x999906db15a10d5a,
|
0x999906db15a10d5a,
|
||||||
0x270fa8d9defc6f79,
|
0x270fa8d9defc6f79,
|
||||||
@ -2575,8 +2573,7 @@ fn test_fq_mul_assign() {
|
|||||||
0x1162b680fb8e9566,
|
0x1162b680fb8e9566,
|
||||||
])));
|
])));
|
||||||
assert!(
|
assert!(
|
||||||
tmp
|
tmp == Fq(FqRepr([
|
||||||
== Fq(FqRepr([
|
|
||||||
0x9dc4000001ebfe14,
|
0x9dc4000001ebfe14,
|
||||||
0x2850078997b00193,
|
0x2850078997b00193,
|
||||||
0xa8197f1abb4d7bf,
|
0xa8197f1abb4d7bf,
|
||||||
|
@ -849,8 +849,7 @@ fn test_fr_repr_sub_noborrow() {
|
|||||||
0x298a30c744b31acf,
|
0x298a30c744b31acf,
|
||||||
]));
|
]));
|
||||||
assert!(
|
assert!(
|
||||||
t
|
t == FrRepr([
|
||||||
== FrRepr([
|
|
||||||
0xb813415048991c1f,
|
0xb813415048991c1f,
|
||||||
0x10ad07ae88725d92,
|
0x10ad07ae88725d92,
|
||||||
0x5a7b851271759961,
|
0x5a7b851271759961,
|
||||||
@ -1252,8 +1251,7 @@ fn test_fr_mul_assign() {
|
|||||||
0x5ae3f03b561a841d,
|
0x5ae3f03b561a841d,
|
||||||
])));
|
])));
|
||||||
assert!(
|
assert!(
|
||||||
tmp
|
tmp == Fr(FrRepr([
|
||||||
== Fr(FrRepr([
|
|
||||||
0x23717213ce710f71,
|
0x23717213ce710f71,
|
||||||
0xdbee1fe53a16e1af,
|
0xdbee1fe53a16e1af,
|
||||||
0xf565d3e1c2a48000,
|
0xf565d3e1c2a48000,
|
||||||
|
@ -350,7 +350,7 @@ impl G2Prepared {
|
|||||||
coeffs.push(doubling_step(&mut r));
|
coeffs.push(doubling_step(&mut r));
|
||||||
|
|
||||||
G2Prepared {
|
G2Prepared {
|
||||||
coeffs: coeffs,
|
coeffs,
|
||||||
infinity: false,
|
infinity: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
32
src/lib.rs
32
src/lib.rs
@ -1,6 +1,3 @@
|
|||||||
// If the "u128-support" feature is enabled, this library can use
|
|
||||||
// more efficient arithmetic. Only available in the nightly compiler.
|
|
||||||
#![cfg_attr(feature = "u128-support", feature(i128_type))]
|
|
||||||
// `clippy` is a code linting tool for improving code quality by catching
|
// `clippy` is a code linting tool for improving code quality by catching
|
||||||
// common mistakes or strange code patterns. If the `clippy` feature is
|
// common mistakes or strange code patterns. If the `clippy` feature is
|
||||||
// provided, it is enabled and all compiler warnings are prohibited.
|
// provided, it is enabled and all compiler warnings are prohibited.
|
||||||
@ -113,8 +110,8 @@ pub trait Engine: Sized + 'static + Clone {
|
|||||||
|
|
||||||
/// Projective representation of an elliptic curve point guaranteed to be
|
/// Projective representation of an elliptic curve point guaranteed to be
|
||||||
/// in the correct prime order subgroup.
|
/// in the correct prime order subgroup.
|
||||||
pub trait CurveProjective
|
pub trait CurveProjective:
|
||||||
: PartialEq
|
PartialEq
|
||||||
+ Eq
|
+ Eq
|
||||||
+ Sized
|
+ Sized
|
||||||
+ Copy
|
+ Copy
|
||||||
@ -124,7 +121,8 @@ pub trait CurveProjective
|
|||||||
+ fmt::Debug
|
+ fmt::Debug
|
||||||
+ fmt::Display
|
+ fmt::Display
|
||||||
+ rand::Rand
|
+ rand::Rand
|
||||||
+ 'static {
|
+ 'static
|
||||||
|
{
|
||||||
type Engine: Engine<Fr = Self::Scalar>;
|
type Engine: Engine<Fr = Self::Scalar>;
|
||||||
type Scalar: PrimeField + SqrtField;
|
type Scalar: PrimeField + SqrtField;
|
||||||
type Base: SqrtField;
|
type Base: SqrtField;
|
||||||
@ -183,8 +181,8 @@ pub trait CurveProjective
|
|||||||
|
|
||||||
/// Affine representation of an elliptic curve point guaranteed to be
|
/// Affine representation of an elliptic curve point guaranteed to be
|
||||||
/// in the correct prime order subgroup.
|
/// in the correct prime order subgroup.
|
||||||
pub trait CurveAffine
|
pub trait CurveAffine:
|
||||||
: Copy + Clone + Sized + Send + Sync + fmt::Debug + fmt::Display + PartialEq + Eq + 'static
|
Copy + Clone + Sized + Send + Sync + fmt::Debug + fmt::Display + PartialEq + Eq + 'static
|
||||||
{
|
{
|
||||||
type Engine: Engine<Fr = Self::Scalar>;
|
type Engine: Engine<Fr = Self::Scalar>;
|
||||||
type Scalar: PrimeField + SqrtField;
|
type Scalar: PrimeField + SqrtField;
|
||||||
@ -235,8 +233,9 @@ pub trait CurveAffine
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An encoded elliptic curve point, which should essentially wrap a `[u8; N]`.
|
/// An encoded elliptic curve point, which should essentially wrap a `[u8; N]`.
|
||||||
pub trait EncodedPoint
|
pub trait EncodedPoint:
|
||||||
: Sized + Send + Sync + AsRef<[u8]> + AsMut<[u8]> + Clone + Copy + 'static {
|
Sized + Send + Sync + AsRef<[u8]> + AsMut<[u8]> + Clone + Copy + 'static
|
||||||
|
{
|
||||||
type Affine: CurveAffine;
|
type Affine: CurveAffine;
|
||||||
|
|
||||||
/// Creates an empty representation.
|
/// Creates an empty representation.
|
||||||
@ -264,8 +263,8 @@ pub trait EncodedPoint
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// This trait represents an element of a field.
|
/// This trait represents an element of a field.
|
||||||
pub trait Field
|
pub trait Field:
|
||||||
: Sized + Eq + Copy + Clone + Send + Sync + fmt::Debug + fmt::Display + 'static + rand::Rand
|
Sized + Eq + Copy + Clone + Send + Sync + fmt::Debug + fmt::Display + 'static + rand::Rand
|
||||||
{
|
{
|
||||||
/// Returns the zero element of the field, the additive identity.
|
/// Returns the zero element of the field, the additive identity.
|
||||||
fn zero() -> Self;
|
fn zero() -> Self;
|
||||||
@ -337,8 +336,8 @@ pub trait SqrtField: Field {
|
|||||||
/// This trait represents a wrapper around a biginteger which can encode any element of a particular
|
/// This trait represents a wrapper around a biginteger which can encode any element of a particular
|
||||||
/// prime field. It is a smart wrapper around a sequence of `u64` limbs, least-significant digit
|
/// prime field. It is a smart wrapper around a sequence of `u64` limbs, least-significant digit
|
||||||
/// first.
|
/// first.
|
||||||
pub trait PrimeFieldRepr
|
pub trait PrimeFieldRepr:
|
||||||
: Sized
|
Sized
|
||||||
+ Copy
|
+ Copy
|
||||||
+ Clone
|
+ Clone
|
||||||
+ Eq
|
+ Eq
|
||||||
@ -352,7 +351,8 @@ pub trait PrimeFieldRepr
|
|||||||
+ rand::Rand
|
+ rand::Rand
|
||||||
+ AsRef<[u64]>
|
+ AsRef<[u64]>
|
||||||
+ AsMut<[u64]>
|
+ AsMut<[u64]>
|
||||||
+ From<u64> {
|
+ From<u64>
|
||||||
|
{
|
||||||
/// Subtract another represetation from this one.
|
/// Subtract another represetation from this one.
|
||||||
fn sub_noborrow(&mut self, other: &Self);
|
fn sub_noborrow(&mut self, other: &Self);
|
||||||
|
|
||||||
@ -566,7 +566,7 @@ impl<E: AsRef<[u64]>> BitIterator<E> {
|
|||||||
pub fn new(t: E) -> Self {
|
pub fn new(t: E) -> Self {
|
||||||
let n = t.as_ref().len() * 64;
|
let n = t.as_ref().len() * 64;
|
||||||
|
|
||||||
BitIterator { t: t, n: n }
|
BitIterator { t, n }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ impl<G: CurveProjective> Wnaf<(), Vec<G>, Vec<i64>> {
|
|||||||
Wnaf {
|
Wnaf {
|
||||||
base: &self.base[..],
|
base: &self.base[..],
|
||||||
scalar: &mut self.scalar,
|
scalar: &mut self.scalar,
|
||||||
window_size: window_size,
|
window_size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ impl<G: CurveProjective> Wnaf<(), Vec<G>, Vec<i64>> {
|
|||||||
Wnaf {
|
Wnaf {
|
||||||
base: &mut self.base,
|
base: &mut self.base,
|
||||||
scalar: &self.scalar[..],
|
scalar: &self.scalar[..],
|
||||||
window_size: window_size,
|
window_size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user