@ -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
// common mistakes or strange code patterns. If the `clippy` feature is
// provided, it is enabled and all compiler warnings are prohibited.
@ -39,42 +36,42 @@ pub trait Engine: Sized + 'static + Clone {
/// The projective representation of an element in G1.
type G1 : CurveProjective <
Engine = Self ,
Base = Self ::Fq ,
Scalar = Self ::Fr ,
Affine = Self ::G1Affine ,
>
Engine = Self ,
Base = Self ::Fq ,
Scalar = Self ::Fr ,
Affine = Self ::G1Affine ,
>
+ From < Self ::G1Affine > ;
/// The affine representation of an element in G1.
type G1Affine : CurveAffine <
Engine = Self ,
Base = Self ::Fq ,
Scalar = Self ::Fr ,
Projective = Self ::G1 ,
Pair = Self ::G2Affine ,
PairingResult = Self ::Fqk ,
>
Engine = Self ,
Base = Self ::Fq ,
Scalar = Self ::Fr ,
Projective = Self ::G1 ,
Pair = Self ::G2Affine ,
PairingResult = Self ::Fqk ,
>
+ From < Self ::G1 > ;
/// The projective representation of an element in G2.
type G2 : CurveProjective <
Engine = Self ,
Base = Self ::Fqe ,
Scalar = Self ::Fr ,
Affine = Self ::G2Affine ,
>
Engine = Self ,
Base = Self ::Fqe ,
Scalar = Self ::Fr ,
Affine = Self ::G2Affine ,
>
+ From < Self ::G2Affine > ;
/// The affine representation of an element in G2.
type G2Affine : CurveAffine <
Engine = Self ,
Base = Self ::Fqe ,
Scalar = Self ::Fr ,
Projective = Self ::G2 ,
Pair = Self ::G1Affine ,
PairingResult = Self ::Fqk ,
>
Engine = Self ,
Base = Self ::Fqe ,
Scalar = Self ::Fr ,
Projective = Self ::G2 ,
Pair = Self ::G1Affine ,
PairingResult = Self ::Fqk ,
>
+ From < Self ::G2 > ;
/// The base field that hosts G1.
@ -113,8 +110,8 @@ pub trait Engine: Sized + 'static + Clone {
/// Projective representation of an elliptic curve point guaranteed to be
/// in the correct prime order subgroup.
pub trait CurveProjective
: PartialEq
pub trait CurveProjective :
PartialEq
+ Eq
+ Sized
+ Copy
@ -124,7 +121,8 @@ pub trait CurveProjective
+ fmt ::Debug
+ fmt ::Display
+ rand ::Rand
+ 'static {
+ 'static
{
type Engine : Engine < Fr = Self ::Scalar > ;
type Scalar : PrimeField + SqrtField ;
type Base : SqrtField ;
@ -183,9 +181,9 @@ pub trait CurveProjective
/// Affine representation of an elliptic curve point guaranteed to be
/// in the correct prime order subgroup.
pub trait CurveAffine
: Copy + Clone + Sized + Send + Sync + fmt ::Debug + fmt ::Display + PartialEq + Eq + 'static
{
pub trait CurveAffine :
Copy + Clone + Sized + Send + Sync + fmt ::Debug + fmt ::Display + PartialEq + Eq + 'static
{
type Engine : Engine < Fr = Self ::Scalar > ;
type Scalar : PrimeField + SqrtField ;
type Base : SqrtField ;
@ -235,8 +233,9 @@ pub trait CurveAffine
}
/// An encoded elliptic curve point, which should essentially wrap a `[u8; N]`.
pub trait EncodedPoint
: Sized + Send + Sync + AsRef < [ u8 ] > + AsMut < [ u8 ] > + Clone + Copy + 'static {
pub trait EncodedPoint :
Sized + Send + Sync + AsRef < [ u8 ] > + AsMut < [ u8 ] > + Clone + Copy + 'static
{
type Affine : CurveAffine ;
/// Creates an empty representation.
@ -264,9 +263,9 @@ pub trait EncodedPoint
}
/// This trait represents an element of a field.
pub trait Field
: Sized + Eq + Copy + Clone + Send + Sync + fmt ::Debug + fmt ::Display + 'static + rand ::Rand
{
pub trait Field :
Sized + Eq + Copy + Clone + Send + Sync + fmt ::Debug + fmt ::Display + 'static + rand ::Rand
{
/// Returns the zero element of the field, the additive identity.
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
/// prime field. It is a smart wrapper around a sequence of `u64` limbs, least-significant digit
/// first.
pub trait PrimeFieldRepr
: Sized
pub trait PrimeFieldRepr :
Sized
+ Copy
+ Clone
+ Eq
@ -352,7 +351,8 @@ pub trait PrimeFieldRepr
+ rand ::Rand
+ AsRef < [ u64 ] >
+ AsMut < [ u64 ] >
+ From < u64 > {
+ From < u64 >
{
/// Subtract another represetation from this one.
fn sub_noborrow ( & mut self , other : & Self ) ;
@ -566,7 +566,7 @@ impl<E: AsRef<[u64]>> BitIterator<E> {
pub fn new ( t : E ) -> Self {
let n = t . as_ref ( ) . len ( ) * 64 ;
BitIterator { t : t , n : n }
BitIterator { t , n }
}
}