Affine

Struct Affine 

Source
pub struct Affine<P: TECurveConfig> {
    pub x: P::BaseField,
    pub y: P::BaseField,
}
Expand description

Affine coordinates for a point on a twisted Edwards curve, over the base field P::BaseField.

Fields§

§x: P::BaseField

X coordinate of the point represented as a field element

§y: P::BaseField

Y coordinate of the point represented as a field element

Implementations§

Source§

impl<P: TECurveConfig> Affine<P>

Source

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

Construct a new group element without checking whether the coordinates specify a point in the subgroup.

Source

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

Construct a new group element in a way while enforcing that points are in the prime-order subgroup.

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

pub const fn zero() -> Self

Construct the identity of the group.

Source

pub fn is_zero(&self) -> bool

Is this point the identity?

Source

pub fn is_on_curve(&self) -> bool

Checks that the current point is on the elliptic curve.

Source§

impl<P: TECurveConfig> Affine<P>

Source

pub fn is_in_prime_order_subgroup(&self) -> bool

Checks if this point is in the prime-order subgroup.

This assumes the point is already on the curve and verifies it belongs to the subgroup with order equal to P::ScalarField.

Trait Implementations§

Source§

impl<'a, P: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig, 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) -> Self::Output

Performs the + operation. Read more
Source§

impl<P: TECurveConfig> 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: TECurveConfig> Clone for Affine<P>
where P::BaseField: 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: TECurveConfig> Debug for Affine<P>

Source§

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

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

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

Source§

fn default() -> Self

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

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

Source§

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

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

impl From<Affine<Curve25519Config>> for CompressedPointY

Source§

fn from(point: AffinePoint) -> Self

Converts to this type from the input type.
Source§

impl<P: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> Hash for Affine<P>
where P::BaseField: 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: TECurveConfig, 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: TECurveConfig> Neg for Affine<P>

Source§

type Output = Affine<P>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<P: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> PartialEq for Affine<P>
where P::BaseField: PartialEq,

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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig, 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) -> Self::Output

Performs the - operation. Read more
Source§

impl<P: TECurveConfig> 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: TECurveConfig> Copy for Affine<P>
where P::BaseField: Copy,

Source§

impl<P: TECurveConfig> Eq for Affine<P>
where P::BaseField: PartialEq,

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.