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>
impl<P: SWCurveConfig> Affine<P>
Sourcepub fn new(x: P::BaseField, y: P::BaseField) -> Self
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.
Sourcepub const fn new_unchecked(x: P::BaseField, y: P::BaseField) -> Self
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.
Sourcepub fn is_on_curve(&self) -> bool
pub fn is_on_curve(&self) -> bool
Checks if self is a valid point on the curve.
Source§impl<P: SWCurveConfig> Affine<P>
impl<P: SWCurveConfig> Affine<P>
Sourcepub fn is_in_prime_order_subgroup(&self) -> bool
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>
impl<'a, P: SWCurveConfig> Add<&'a Projective<P>> for Affine<P>
Source§type Output = Projective<P>
type Output = Projective<P>
The resulting type after applying the
+ operator.Source§fn add(self, other: &'a Projective<P>) -> Projective<P>
fn add(self, other: &'a Projective<P>) -> Projective<P>
Performs the
+ operation. Read moreSource§impl<P: SWCurveConfig> Add<Projective<P>> for Affine<P>
impl<P: SWCurveConfig> Add<Projective<P>> for Affine<P>
Source§type Output = Projective<P>
type Output = Projective<P>
The resulting type after applying the
+ operator.Source§fn add(self, other: Projective<P>) -> Projective<P>
fn add(self, other: Projective<P>) -> Projective<P>
Performs the
+ operation. Read moreSource§impl<P: SWCurveConfig, T: Borrow<Self>> Add<T> for Affine<P>
impl<P: SWCurveConfig, T: Borrow<Self>> Add<T> for Affine<P>
Source§type Output = Projective<P>
type Output = Projective<P>
The resulting type after applying the
+ operator.Source§fn add(self, other: T) -> Projective<P>
fn add(self, other: T) -> Projective<P>
Performs the
+ operation. Read moreSource§impl<P: SWCurveConfig> AffineRepr for Affine<P>
impl<P: SWCurveConfig> AffineRepr for Affine<P>
Source§fn mul_by_cofactor_to_group(&self) -> Self::Group
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
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
type BaseField = <P as CurveConfig>::BaseField
Base field that the curve is defined over.
Source§type Group = Projective<P>
type Group = Projective<P>
The projective representation of points on this curve.
Source§type ScalarField = <P as CurveConfig>::ScalarField
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)>
fn xy(&self) -> Option<(Self::BaseField, Self::BaseField)>
Returns the x and y coordinates of this affine point.
Source§fn mul_bigint(&self, by: impl BitIteratorBE) -> Self::Group
fn mul_bigint(&self, by: impl BitIteratorBE) -> Self::Group
Performs scalar multiplication of this element with mixed addition.
Source§fn into_group(self) -> Self::Group
fn into_group(self) -> Self::Group
Converts self into the projective representation.
Source§fn mul_by_cofactor(&self) -> Self
fn mul_by_cofactor(&self) -> Self
Multiplies this element by the cofactor.
Source§fn mul_by_cofactor_inv(&self) -> Self
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>
impl<P: SWCurveConfig> Clone for Affine<P>
Source§impl<P: SWCurveConfig> Debug for Affine<P>
impl<P: SWCurveConfig> Debug for Affine<P>
Source§impl<P: SWCurveConfig> Default for Affine<P>
impl<P: SWCurveConfig> Default for Affine<P>
Source§impl<P: SWCurveConfig> Display for Affine<P>
impl<P: SWCurveConfig> Display for Affine<P>
Source§impl<P: SWCurveConfig> From<Affine<P>> for Projective<P>
impl<P: SWCurveConfig> From<Affine<P>> for Projective<P>
Source§fn from(p: Affine<P>) -> Projective<P>
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>
impl<P: SWCurveConfig> From<Projective<P>> for Affine<P>
Source§fn from(p: Projective<P>) -> Affine<P>
fn from(p: Projective<P>) -> Affine<P>
Converts to this type from the input type.
Source§impl<P: SWCurveConfig> Hash for Affine<P>
impl<P: SWCurveConfig> Hash for Affine<P>
Source§impl<P: SWCurveConfig, T: Borrow<P::ScalarField>> Mul<T> for Affine<P>
impl<P: SWCurveConfig, T: Borrow<P::ScalarField>> Mul<T> for Affine<P>
Source§impl<P: SWCurveConfig> Neg for Affine<P>
impl<P: SWCurveConfig> Neg for Affine<P>
Source§impl<P: SWCurveConfig> PartialEq<Affine<P>> for Projective<P>
impl<P: SWCurveConfig> PartialEq<Affine<P>> for Projective<P>
Source§impl<P: SWCurveConfig> PartialEq<Projective<P>> for Affine<P>
impl<P: SWCurveConfig> PartialEq<Projective<P>> for Affine<P>
Source§impl<P: SWCurveConfig> PartialEq for Affine<P>
impl<P: SWCurveConfig> PartialEq for Affine<P>
Source§impl<'a, P: SWCurveConfig> Sub<&'a Projective<P>> for Affine<P>
impl<'a, P: SWCurveConfig> Sub<&'a Projective<P>> for Affine<P>
Source§type Output = Projective<P>
type Output = Projective<P>
The resulting type after applying the
- operator.Source§fn sub(self, other: &'a Projective<P>) -> Projective<P>
fn sub(self, other: &'a Projective<P>) -> Projective<P>
Performs the
- operation. Read moreSource§impl<P: SWCurveConfig> Sub<Projective<P>> for Affine<P>
impl<P: SWCurveConfig> Sub<Projective<P>> for Affine<P>
Source§type Output = Projective<P>
type Output = Projective<P>
The resulting type after applying the
- operator.Source§fn sub(self, other: Projective<P>) -> Projective<P>
fn sub(self, other: Projective<P>) -> Projective<P>
Performs the
- operation. Read moreSource§impl<P: SWCurveConfig, T: Borrow<Self>> Sub<T> for Affine<P>
impl<P: SWCurveConfig, T: Borrow<Self>> Sub<T> for Affine<P>
Source§type Output = Projective<P>
type Output = Projective<P>
The resulting type after applying the
- operator.Source§fn sub(self, other: T) -> Projective<P>
fn sub(self, other: T) -> Projective<P>
Performs the
- operation. Read moreSource§impl<P: SWCurveConfig> Zeroize for Affine<P>
impl<P: SWCurveConfig> Zeroize for Affine<P>
impl<P: SWCurveConfig> Copy for Affine<P>
impl<P: SWCurveConfig> Eq for Affine<P>
Auto Trait Implementations§
impl<P> Freeze for Affine<P>
impl<P> RefUnwindSafe for Affine<P>
impl<P> Send for Affine<P>
impl<P> Sync for Affine<P>
impl<P> Unpin for Affine<P>
impl<P> UnwindSafe for Affine<P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more