mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-07 20:30:34 +00:00
Remove FieldExt trait
One, two! One, two! And through and through The vorpal blade went snicker-snack! He left it dead, and with its head He went galumphing back. Closes zcash/pasta_curves#42.
This commit is contained in:
parent
56b73e32ce
commit
825cb944de
6 changed files with 8 additions and 18 deletions
|
|
@ -11,6 +11,7 @@ and this project adheres to Rust's notion of
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- `pasta_curves::arithmetic`:
|
- `pasta_curves::arithmetic`:
|
||||||
|
- `FieldExt` (use `ff::PrimeField` or `ff::WithSmallOrderMulGroup` instead).
|
||||||
- `Group`
|
- `Group`
|
||||||
- `SqrtRatio` (use `ff::Field::{sqrt_ratio, sqrt_alt}` instead).
|
- `SqrtRatio` (use `ff::Field::{sqrt_ratio, sqrt_alt}` instead).
|
||||||
- `SqrtTables` (from public API, as it isn't suitable for generic usage).
|
- `SqrtTables` (from public API, as it isn't suitable for generic usage).
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,4 @@ mod curves;
|
||||||
mod fields;
|
mod fields;
|
||||||
|
|
||||||
pub use curves::*;
|
pub use curves::*;
|
||||||
pub use fields::*;
|
pub(crate) use fields::*;
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,6 @@ use group::prime::{PrimeCurve, PrimeCurveAffine};
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
|
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
|
||||||
use super::FieldExt;
|
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
|
|
@ -30,9 +27,9 @@ pub trait CurveExt:
|
||||||
+ From<<Self as PrimeCurve>::Affine>
|
+ From<<Self as PrimeCurve>::Affine>
|
||||||
{
|
{
|
||||||
/// The scalar field of this elliptic curve.
|
/// The scalar field of this elliptic curve.
|
||||||
type ScalarExt: FieldExt;
|
type ScalarExt: ff::WithSmallOrderMulGroup<3>;
|
||||||
/// The base field over which this elliptic curve is constructed.
|
/// The base field over which this elliptic curve is constructed.
|
||||||
type Base: FieldExt;
|
type Base: ff::WithSmallOrderMulGroup<3>;
|
||||||
/// The affine version of the curve
|
/// The affine version of the curve
|
||||||
type AffineExt: CurveAffine<CurveExt = Self, ScalarExt = <Self as CurveExt>::ScalarExt>
|
type AffineExt: CurveAffine<CurveExt = Self, ScalarExt = <Self as CurveExt>::ScalarExt>
|
||||||
+ Mul<Self::ScalarExt, Output = Self>
|
+ Mul<Self::ScalarExt, Output = Self>
|
||||||
|
|
@ -102,9 +99,9 @@ pub trait CurveAffine:
|
||||||
+ From<<Self as PrimeCurveAffine>::Curve>
|
+ From<<Self as PrimeCurveAffine>::Curve>
|
||||||
{
|
{
|
||||||
/// The scalar field of this elliptic curve.
|
/// The scalar field of this elliptic curve.
|
||||||
type ScalarExt: FieldExt + Ord;
|
type ScalarExt: ff::WithSmallOrderMulGroup<3> + Ord;
|
||||||
/// The base field over which this elliptic curve is constructed.
|
/// The base field over which this elliptic curve is constructed.
|
||||||
type Base: FieldExt + Ord;
|
type Base: ff::WithSmallOrderMulGroup<3> + Ord;
|
||||||
/// The projective form of the curve
|
/// The projective form of the curve
|
||||||
type CurveExt: CurveExt<AffineExt = Self, ScalarExt = <Self as CurveAffine>::ScalarExt>;
|
type CurveExt: CurveExt<AffineExt = Self, ScalarExt = <Self as CurveAffine>::ScalarExt>;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,6 @@ pub(crate) trait SqrtTableHelpers: ff::PrimeField {
|
||||||
fn get_lower_32(&self) -> u32;
|
fn get_lower_32(&self) -> u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This trait is a common interface for dealing with elements of a finite
|
|
||||||
/// field.
|
|
||||||
pub trait FieldExt: ff::WithSmallOrderMulGroup<3> {}
|
|
||||||
|
|
||||||
/// Parameters for a perfect hash function used in square root computation.
|
/// Parameters for a perfect hash function used in square root computation.
|
||||||
#[cfg(feature = "sqrt-table")]
|
#[cfg(feature = "sqrt-table")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "sqrt-table")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "sqrt-table")))]
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use lazy_static::lazy_static;
|
||||||
#[cfg(feature = "bits")]
|
#[cfg(feature = "bits")]
|
||||||
use ff::{FieldBits, PrimeFieldBits};
|
use ff::{FieldBits, PrimeFieldBits};
|
||||||
|
|
||||||
use crate::arithmetic::{adc, mac, sbb, FieldExt, SqrtTableHelpers};
|
use crate::arithmetic::{adc, mac, sbb, SqrtTableHelpers};
|
||||||
|
|
||||||
#[cfg(feature = "sqrt-table")]
|
#[cfg(feature = "sqrt-table")]
|
||||||
use crate::arithmetic::SqrtTables;
|
use crate::arithmetic::SqrtTables;
|
||||||
|
|
@ -728,8 +728,6 @@ impl SqrtTableHelpers for Fp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FieldExt for Fp {}
|
|
||||||
|
|
||||||
impl WithSmallOrderMulGroup<3> for Fp {
|
impl WithSmallOrderMulGroup<3> for Fp {
|
||||||
const ZETA: Self = Fp::from_raw([
|
const ZETA: Self = Fp::from_raw([
|
||||||
0x1dad5ebdfdfe4ab9,
|
0x1dad5ebdfdfe4ab9,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use lazy_static::lazy_static;
|
||||||
#[cfg(feature = "bits")]
|
#[cfg(feature = "bits")]
|
||||||
use ff::{FieldBits, PrimeFieldBits};
|
use ff::{FieldBits, PrimeFieldBits};
|
||||||
|
|
||||||
use crate::arithmetic::{adc, mac, sbb, FieldExt, SqrtTableHelpers};
|
use crate::arithmetic::{adc, mac, sbb, SqrtTableHelpers};
|
||||||
|
|
||||||
#[cfg(feature = "sqrt-table")]
|
#[cfg(feature = "sqrt-table")]
|
||||||
use crate::arithmetic::SqrtTables;
|
use crate::arithmetic::SqrtTables;
|
||||||
|
|
@ -727,8 +727,6 @@ impl SqrtTableHelpers for Fq {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FieldExt for Fq {}
|
|
||||||
|
|
||||||
impl WithSmallOrderMulGroup<3> for Fq {
|
impl WithSmallOrderMulGroup<3> for Fq {
|
||||||
const ZETA: Self = Fq::from_raw([
|
const ZETA: Self = Fq::from_raw([
|
||||||
0x2aa9d2e050aa0e4f,
|
0x2aa9d2e050aa0e4f,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue