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>
impl<F: Field, C: EdwardsCurve<F>> EdwardsPointExpression<F, C>
Sourcepub fn compressed(&self) -> &Expression<F>
pub fn compressed(&self) -> &Expression<F>
Returns the Y coordinate of an EdwardsPointExpression
Sourcepub fn add(
builder: &mut GadgetBuilder<F>,
point_1: &EdwardsPointExpression<F, C>,
point_2: &EdwardsPointExpression<F, C>,
) -> EdwardsPointExpression<F, C>
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.
Sourcepub fn double(
builder: &mut GadgetBuilder<F>,
point: &EdwardsPointExpression<F, C>,
) -> EdwardsPointExpression<F, C>
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.
Sourcepub fn scalar_mult(
builder: &mut GadgetBuilder<F>,
point: &EdwardsPointExpression<F, C>,
scalar: &Expression<F>,
) -> EdwardsPointExpression<F, C>
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.
Sourcepub fn identity() -> EdwardsPointExpression<F, C>
pub fn identity() -> EdwardsPointExpression<F, C>
Identity element for twisted Edwards Curve
Sourcepub fn from_elements(
x: Element<F>,
y: Element<F>,
) -> EdwardsPointExpression<F, C>
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
Sourcepub fn from_edwards_point(p: EdwardsPoint<F, C>) -> EdwardsPointExpression<F, C>
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
Sourcepub fn from_expressions(
builder: &mut GadgetBuilder<F>,
x: Expression<F>,
y: Expression<F>,
) -> EdwardsPointExpression<F, C>
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
Sourcepub fn from_expressions_unsafe(
x: Expression<F>,
y: Expression<F>,
) -> EdwardsPointExpression<F, C>
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
Sourcepub fn evaluate(&self, values: &WireValues<F>) -> EdwardsPoint<F, C>
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>
impl<F: Field, C: EdwardsCurve<F>> Clone for EdwardsPointExpression<F, C>
Auto Trait Implementations§
impl<F, C> Freeze for EdwardsPointExpression<F, C>
impl<F, C> RefUnwindSafe for EdwardsPointExpression<F, C>where
C: RefUnwindSafe,
F: RefUnwindSafe,
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>where
C: RefUnwindSafe,
F: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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