Struct EdwardsPointExpression

Source
pub struct EdwardsPointExpression<F: Field, C: EdwardsCurve<F>> { /* private fields */ }
Expand description

An embedded Edwards curve point defined over the same base field as the field used in the constraint system, with affine coordinates as expressions.

Implementations§

Source§

impl<F: Field, C: EdwardsCurve<F>> EdwardsPointExpression<F, C>

Source

pub fn compressed(&self) -> &Expression<F>

Returns the Y coordinate of an EdwardsPointExpression

Source

pub fn add( builder: &mut GadgetBuilder<F>, point_1: &EdwardsPointExpression<F, C>, point_2: &EdwardsPointExpression<F, C>, ) -> EdwardsPointExpression<F, C>

Assumes that the EdwardsPointExpressions are known to be contained on the curve (and omits a membership check), so the non-deterministic inversion method is valid.

Source

pub fn double( builder: &mut GadgetBuilder<F>, point: &EdwardsPointExpression<F, C>, ) -> EdwardsPointExpression<F, C>

Naive implementation of the doubling algorithm for twisted Edwards curves.

Assuming that EdwardsPointExpressions are on the curve, so the non-deterministic division method is acceptable, as the denominator is non-zero.

Note that this algorithm requires the point to be of odd order, which, in the case of prime-order subgroups of Edwards curves, is satisfied.

Source

pub fn scalar_mult( builder: &mut GadgetBuilder<F>, point: &EdwardsPointExpression<F, C>, scalar: &Expression<F>, ) -> EdwardsPointExpression<F, C>

Multiplies an EdwardsPointExpression by a scalar using a naive approach consisting of multiplication by doubling.

Source

pub fn identity() -> EdwardsPointExpression<F, C>

Identity element for twisted Edwards Curve

Source

pub fn from_elements( x: Element<F>, y: Element<F>, ) -> EdwardsPointExpression<F, C>

Takes two elements as coordinates, checks that they’re on the curve without adding constraints, and then returns an EdwardsPointExpression

Source

pub fn from_edwards_point(p: EdwardsPoint<F, C>) -> EdwardsPointExpression<F, C>

Converts an EdwardsPoint into an EdwardsPointExpression. Assumes that the coordinates of the EdwardsPoint have already been verified on the curve

Source

pub fn from_expressions( builder: &mut GadgetBuilder<F>, x: Expression<F>, y: Expression<F>, ) -> EdwardsPointExpression<F, C>

Takes two expressions as coordinates, adds constraints verifying that the coordinates are contained on the specified curve, and then returns an EdwardsPointExpression

Source

pub fn from_expressions_unsafe( x: Expression<F>, y: Expression<F>, ) -> EdwardsPointExpression<F, C>

Takes two expressions as coordinates, does not perform a check or add constraints to check that the coordinates are on the specified curve, and then returns an EdwardsPointExpression

Source

pub fn evaluate(&self, values: &WireValues<F>) -> EdwardsPoint<F, C>

Evaluates the EdwardsPointExpression by evaluating the expression in each coordinate

Trait Implementations§

Source§

impl<F: Field, C: EdwardsCurve<F>> Clone for EdwardsPointExpression<F, C>

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

Auto Trait Implementations§

§

impl<F, C> Freeze for EdwardsPointExpression<F, C>

§

impl<F, C> RefUnwindSafe for EdwardsPointExpression<F, C>

§

impl<F, C> !Send for EdwardsPointExpression<F, C>

§

impl<F, C> !Sync for EdwardsPointExpression<F, C>

§

impl<F, C> Unpin for EdwardsPointExpression<F, C>

§

impl<F, C> UnwindSafe for EdwardsPointExpression<F, C>

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> 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> 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.