AffineRepr

Trait AffineRepr 

Source
pub trait AffineRepr:
    Eq
    + 'static
    + Sized
    + Copy
    + Clone
    + Default
    + Send
    + Sync
    + Hash
    + Debug
    + Display
    + Zeroize
    + Neg
    + From<Self::Group>
    + Into<Self::Group>
    + Add<Self, Output = Self::Group>
    + for<'a> Add<&'a Self, Output = Self::Group>
    + Add<Self::Group, Output = Self::Group>
    + for<'a> Add<&'a Self::Group, Output = Self::Group>
    + Sub<Self, Output = Self::Group>
    + for<'a> Sub<&'a Self, Output = Self::Group>
    + Sub<Self::Group, Output = Self::Group>
    + for<'a> Sub<&'a Self::Group, Output = Self::Group>
    + Mul<Self::ScalarField, Output = Self::Group>
    + for<'a> Mul<&'a Self::ScalarField, Output = Self::Group> {
    type Config: CurveConfig<ScalarField = Self::ScalarField, BaseField = Self::BaseField>;
    type ScalarField: PrimeField;
    type BaseField: Field;
    type Group: CurveGroup<Config = Self::Config, Affine = Self, ScalarField = Self::ScalarField, BaseField = Self::BaseField> + From<Self> + Into<Self> + MulAssign<Self::ScalarField>;

    // Required methods
    fn xy(&self) -> Option<(Self::BaseField, Self::BaseField)>;
    fn zero() -> Self;
    fn generator() -> Self;
    fn mul_bigint(&self, by: impl BitIteratorBE) -> Self::Group;
    fn clear_cofactor(&self) -> Self;
    fn mul_by_cofactor_to_group(&self) -> Self::Group;

    // Provided methods
    fn x(&self) -> Option<Self::BaseField> { ... }
    fn y(&self) -> Option<Self::BaseField> { ... }
    fn is_zero(&self) -> bool { ... }
    fn into_group(self) -> Self::Group { ... }
    fn mul_by_cofactor(&self) -> Self { ... }
    fn mul_by_cofactor_inv(&self) -> Self { ... }
}
Expand description

The canonical representation of an elliptic curve group element. This should represent the affine coordinates of the point corresponding to this group element.

The point is guaranteed to be in the correct prime order subgroup.

Required Associated Types§

Source

type Config: CurveConfig<ScalarField = Self::ScalarField, BaseField = Self::BaseField>

Associated configuration for this curve.

Source

type ScalarField: PrimeField

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

Source

type BaseField: Field

Base field that the curve is defined over.

Source

type Group: CurveGroup<Config = Self::Config, Affine = Self, ScalarField = Self::ScalarField, BaseField = Self::BaseField> + From<Self> + Into<Self> + MulAssign<Self::ScalarField>

The projective representation of points on this curve.

Required Methods§

Source

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

Returns the x and y coordinates of this affine point.

Source

fn zero() -> Self

Returns the point at infinity.

Source

fn generator() -> Self

Returns a fixed generator of unknown exponent.

Source

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

Performs scalar multiplication of this element with mixed addition.

Source

fn clear_cofactor(&self) -> Self

Performs cofactor clearing. The default method is simply to multiply by the cofactor. For some curve families more efficient methods exist.

Source

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

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

Provided Methods§

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<P: SWCurveConfig> AffineRepr for openzeppelin_crypto::curve::sw::Affine<P>

Source§

impl<P: TECurveConfig> AffineRepr for openzeppelin_crypto::curve::te::Affine<P>