Affine

Struct Affine 

Source
pub struct Affine<P: SWCurveConfig> { /* private fields */ }
Expand description

Affine coordinates for a point on an elliptic curve in short Weierstrass form, over the base field P::BaseField.

Implementations§

Source§

impl<P: SWCurveConfig> Affine<P>

Source

pub fn new(x: P::BaseField, y: P::BaseField) -> Self

Constructs a group element from x and y coordinates. Performs checks to ensure that the point is on the curve and is in the right subgroup.

§Panics
  • If point is not on curve.
  • If point is not in the prime-order subgroup.
Source

pub const fn new_unchecked(x: P::BaseField, y: P::BaseField) -> Self

Constructs a group element from x and y coordinates.

§Warning

Does not perform any checks to ensure the point is in the curve or is in the right subgroup.

Source

pub const fn identity() -> Self

Additive identity element of the curve group.

Source

pub fn is_on_curve(&self) -> bool

Checks if self is a valid point on the curve.

Source§

impl<P: SWCurveConfig> Affine<P>

Source

pub fn is_in_prime_order_subgroup(&self) -> bool

Checks if self is in the subgroup having order that equaling that of P::ScalarField.

Trait Implementations§

Source§

impl<'a, P: SWCurveConfig> Add<&'a Projective<P>> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a Projective<P>) -> Projective<P>

Performs the + operation. Read more
Source§

impl<P: SWCurveConfig> Add<Projective<P>> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: Projective<P>) -> Projective<P>

Performs the + operation. Read more
Source§

impl<P: SWCurveConfig, T: Borrow<Self>> Add<T> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: T) -> Projective<P>

Performs the + operation. Read more
Source§

impl<P: SWCurveConfig> AffineRepr for Affine<P>

Source§

fn mul_by_cofactor_to_group(&self) -> Self::Group

Multiplies this element by the cofactor and output the resulting projective element.

Source§

fn clear_cofactor(&self) -> Self

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

Source§

type BaseField = <P as CurveConfig>::BaseField

Base field that the curve is defined over.
Source§

type Config = P

Associated configuration for this curve.
Source§

type Group = Projective<P>

The projective representation of points on this curve.
Source§

type ScalarField = <P as CurveConfig>::ScalarField

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

fn xy(&self) -> Option<(Self::BaseField, Self::BaseField)>

Returns the x and y coordinates of this affine point.
Source§

fn generator() -> Self

Returns a fixed generator of unknown exponent.
Source§

fn zero() -> Self

Returns the point at infinity.
Source§

fn mul_bigint(&self, by: impl BitIteratorBE) -> Self::Group

Performs scalar multiplication of this element with mixed addition.
Source§

fn x(&self) -> Option<Self::BaseField>

Returns the x coordinate of this affine point.
Source§

fn y(&self) -> Option<Self::BaseField>

Returns the y coordinate of this affine point.
Source§

fn is_zero(&self) -> bool

Is self the point at infinity?
Source§

fn into_group(self) -> Self::Group

Converts self into the projective representation.
Source§

fn mul_by_cofactor(&self) -> Self

Multiplies this element by the cofactor.
Source§

fn mul_by_cofactor_inv(&self) -> Self

Multiplies this element by the inverse of the cofactor in Self::ScalarField.
Source§

impl<P: SWCurveConfig> Clone for Affine<P>
where P::BaseField: Copy, bool: Copy,

Source§

fn clone(&self) -> Self

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<P: SWCurveConfig> Debug for Affine<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: SWCurveConfig> Default for Affine<P>

Source§

fn default() -> Self

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

impl<P: SWCurveConfig> Display for Affine<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: SWCurveConfig> From<Affine<P>> for Projective<P>

Source§

fn from(p: Affine<P>) -> Projective<P>

Converts to this type from the input type.
Source§

impl<P: SWCurveConfig> From<Projective<P>> for Affine<P>

Source§

fn from(p: Projective<P>) -> Affine<P>

Converts to this type from the input type.
Source§

impl<P: SWCurveConfig> Hash for Affine<P>
where P::BaseField: Hash, bool: Hash,

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<P: SWCurveConfig, T: Borrow<P::ScalarField>> Mul<T> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<P: SWCurveConfig> Neg for Affine<P>

Source§

fn neg(self) -> Self

If self.is_zero(), returns self (== Self::zero()). Else, returns (x, -y), where self = (x, y).

Source§

type Output = Affine<P>

The resulting type after applying the - operator.
Source§

impl<P: SWCurveConfig> PartialEq<Affine<P>> for Projective<P>

Source§

fn eq(&self, other: &Affine<P>) -> 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<P: SWCurveConfig> PartialEq<Projective<P>> for Affine<P>

Source§

fn eq(&self, other: &Projective<P>) -> 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<P: SWCurveConfig> PartialEq for Affine<P>

Source§

fn eq(&self, other: &Self) -> 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<'a, P: SWCurveConfig> Sub<&'a Projective<P>> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'a Projective<P>) -> Projective<P>

Performs the - operation. Read more
Source§

impl<P: SWCurveConfig> Sub<Projective<P>> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Projective<P>) -> Projective<P>

Performs the - operation. Read more
Source§

impl<P: SWCurveConfig, T: Borrow<Self>> Sub<T> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: T) -> Projective<P>

Performs the - operation. Read more
Source§

impl<P: SWCurveConfig> Zeroize for Affine<P>

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
Source§

impl<P: SWCurveConfig> Copy for Affine<P>
where P::BaseField: Copy, bool: Copy,

Source§

impl<P: SWCurveConfig> Eq for Affine<P>

Auto Trait Implementations§

§

impl<P> Freeze for Affine<P>
where <P as CurveConfig>::BaseField: Freeze,

§

impl<P> RefUnwindSafe for Affine<P>

§

impl<P> Send for Affine<P>

§

impl<P> Sync for Affine<P>

§

impl<P> Unpin for Affine<P>
where <P as CurveConfig>::BaseField: Unpin,

§

impl<P> UnwindSafe for Affine<P>

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<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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.