Parameters

Struct Parameters 

Source
pub struct Parameters;

Trait Implementations§

Source§

impl Clone for Parameters

Source§

fn clone(&self) -> Parameters

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CurveConfig for Parameters

Source§

const COFACTOR: &'static [u64]

COFACTOR = (x - 1)^2 / 3 = 30631250834960419227450344600217059328

Source§

const COFACTOR_INV: Fp<MontBackend<FrConfig, 4>, 4>

COFACTOR_INV = COFACTOR^{-1} mod r = 5285428838741532253824584287042945485047145357130994810877

Source§

type BaseField = Fp<MontBackend<FqConfig, 6>, 6>

Base field that the curve is defined over.
Source§

type ScalarField = Fp<MontBackend<FrConfig, 4>, 4>

Finite prime field corresponding to an appropriate prime-order subgroup of the curve group.
Source§

fn cofactor_is_one() -> bool

Source§

impl Default for Parameters

Source§

fn default() -> Parameters

Returns the “default value” for a type. Read more
Source§

impl MontCurveConfig for Parameters

Source§

const COEFF_A: Fp<MontBackend<FqConfig, 6>, 6>

COEFF_A = 228097355113300204138531148905234651262148041026195375645000724271212049151994375092458297304264351187709081232384

Source§

const COEFF_B: Fp<MontBackend<FqConfig, 6>, 6>

COEFF_B = 10189023633222963290707194929886294091415157242906428298294512798502806398782149227503530278436336312243746741931

Source§

type TECurveConfig = Parameters

Model parameters for the Twisted Edwards curve that is birationally equivalent to this curve.
Source§

impl PartialEq for Parameters

Source§

fn eq(&self, other: &Parameters) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl SWCurveConfig for Parameters

Source§

const COEFF_A: Fp<MontBackend<FqConfig, 6>, 6> = Fq::ZERO

COEFF_A = 0

Source§

const COEFF_B: Fp<MontBackend<FqConfig, 6>, 6> = Fq::ONE

COEFF_B = 1

Source§

const GENERATOR: Affine<Parameters>

AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)

Source§

fn mul_by_a( _: <Parameters as CurveConfig>::BaseField, ) -> <Parameters as CurveConfig>::BaseField

Helper method for computing elem * Self::COEFF_A. Read more
Source§

fn add_b(elem: Self::BaseField) -> Self::BaseField

Helper method for computing elem + Self::COEFF_B. Read more
Source§

fn is_in_correct_subgroup_assuming_on_curve(item: &Affine<Self>) -> bool

Check if the provided curve point is in the prime-order subgroup. Read more
Source§

fn clear_cofactor(item: &Affine<Self>) -> Affine<Self>

Performs cofactor clearing. The default method is simply to multiply by the cofactor. Some curves can implement a more efficient algorithm.
Source§

fn mul_projective(base: &Projective<Self>, scalar: &[u64]) -> Projective<Self>

Default implementation of group multiplication for projective coordinates
Source§

fn mul_affine(base: &Affine<Self>, scalar: &[u64]) -> Projective<Self>

Default implementation of group multiplication for affine coordinates.
Source§

fn serialize_with_mode<W>( item: &Affine<Self>, writer: W, compress: Compress, ) -> Result<(), SerializationError>
where W: Write,

If uncompressed, serializes both x and y coordinates as well as a bit for whether it is infinity. If compressed, serializes x coordinate with two bits to encode whether y is positive, negative, or infinity.
Source§

fn deserialize_with_mode<R>( reader: R, compress: Compress, validate: Validate, ) -> Result<Affine<Self>, SerializationError>
where R: Read,

If validate is Yes, calls check() to make sure the element is valid.
Source§

fn serialized_size(compress: Compress) -> usize

Source§

impl TECurveConfig for Parameters

Bls12_377::G1 also has a twisted Edwards form. It can be obtained via the following script, implementing

  1. SW -> Montgomery -> TE1 transformation: https://en.wikipedia.org/wiki/Montgomery_curve
  2. TE1 -> TE2 normalization (enforcing a = -1)
# modulus
p = 0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c00000000001
Fp = Zmod(p)

#####################################################
# Weierstrass curve: y² = x³ + A * x + B
#####################################################
# curve y^2 = x^3 + 1
WA = Fp(0)
WB = Fp(1)

#####################################################
# Montgomery curve: By² = x³ + A * x² + x
#####################################################
# root for x^3 + 1 = 0
alpha = -1
# s = 1 / (sqrt(3alpha^2 + a))
s = 1/(Fp(3).sqrt())

# MA = 3 * alpha * s
MA = Fp(228097355113300204138531148905234651262148041026195375645000724271212049151994375092458297304264351187709081232384)
# MB = s
MB = Fp(10189023633222963290707194929886294091415157242906428298294512798502806398782149227503530278436336312243746741931)

# #####################################################
# # Twisted Edwards curve 1: a * x² + y² = 1 + d * x² * y²
# #####################################################
# We first convert to TE form obtaining a curve with a != -1, and then
# apply a transformation to obtain a TE curve with a = -1.
# a = (MA+2)/MB
TE1a = Fp(61134141799337779744243169579317764548490943457438569789767076791016838392692895365021181670618017873462480451583)
# b = (MA-2)/MB
TE1d = Fp(197530284213631314266409564115575768987902569297476090750117185875703629955647927409947706468955342250977841006588)

# #####################################################
# # Twisted Edwards curve 2: a * x² + y² = 1 + d * x² * y²
# #####################################################
# a = -1
TE2a = Fp(-1)
# b = -TE1d/TE1a
TE2d = Fp(122268283598675559488486339158635529096981886914877139579534153582033676785385790730042363341236035746924960903179)
Source§

const COEFF_A: Fp<MontBackend<FqConfig, 6>, 6>

COEFF_A = -1

Source§

const COEFF_D: Fp<MontBackend<FqConfig, 6>, 6>

COEFF_D = 122268283598675559488486339158635529096981886914877139579534153582033676785385790730042363341236035746924960903179 mod q

Source§

const GENERATOR: Affine<Parameters>

AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y)

Source§

fn mul_by_a( elem: <Parameters as CurveConfig>::BaseField, ) -> <Parameters as CurveConfig>::BaseField

Multiplication by a is multiply by -1.

Source§

type MontCurveConfig = Parameters

Model parameters for the Montgomery curve that is birationally equivalent to this curve.
Source§

fn is_in_correct_subgroup_assuming_on_curve(item: &Affine<Self>) -> bool

Checks that the current point is in the prime order subgroup given the point on the curve.
Source§

fn clear_cofactor(item: &Affine<Self>) -> Affine<Self>

Performs cofactor clearing. The default method is simply to multiply by the cofactor. For some curve families though, it is sufficient to multiply by a smaller scalar.
Source§

fn mul_projective(base: &Projective<Self>, scalar: &[u64]) -> Projective<Self>

Default implementation of group multiplication for projective coordinates
Source§

fn mul_affine(base: &Affine<Self>, scalar: &[u64]) -> Projective<Self>

Default implementation of group multiplication for affine coordinates
Source§

fn serialize_with_mode<W>( item: &Affine<Self>, writer: W, compress: Compress, ) -> Result<(), SerializationError>
where W: Write,

If uncompressed, serializes both x and y coordinates. If compressed, serializes y coordinate with a bit to encode whether x is positive.
Source§

fn deserialize_with_mode<R>( reader: R, compress: Compress, validate: Validate, ) -> Result<Affine<Self>, SerializationError>
where R: Read,

If validate is Yes, calls check() to make sure the element is valid. Read more
Source§

fn serialized_size(compress: Compress) -> usize

Source§

impl Eq for Parameters

Source§

impl StructuralPartialEq for Parameters

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V