pub struct Group<E: Environment> { /* private fields */ }
Implementations§
Source§impl<E: Environment> Group<E>
impl<E: Environment> Group<E>
Sourcepub fn from_x_coordinate(x: Field<E>) -> Self
pub fn from_x_coordinate(x: Field<E>) -> Self
Initializes an affine group element from a given x-coordinate field element. For safety, the resulting point is always enforced to be on the curve with constraints.
Sourcepub fn from_x_coordinate_flagged(x: Field<E>) -> (Self, Boolean<E>)
pub fn from_x_coordinate_flagged(x: Field<E>) -> (Self, Boolean<E>)
Initializes an affine group element from a given x-coordinate field element.
Additionally, returns an error flag.
If the error flag is set, there is no group element with the given x-coordinate.
If the error flag is set, the returned point is (0, 0)
.
Source§impl<E: Environment> Group<E>
impl<E: Environment> Group<E>
Sourcepub fn from_xy_coordinates(x: Field<E>, y: Field<E>) -> Self
pub fn from_xy_coordinates(x: Field<E>, y: Field<E>) -> Self
Initializes an affine group element from a given x- and y-coordinate field element. For safety, the resulting point is always enforced to be on the curve and in the subgroup.
Source§impl<E: Environment> Group<E>
impl<E: Environment> Group<E>
Sourcepub fn mul_by_cofactor(&self) -> Group<E>
pub fn mul_by_cofactor(&self) -> Group<E>
Returns the product of the group element and the cofactor.
Source§impl<E: Environment> Group<E>
impl<E: Environment> Group<E>
Sourcepub fn to_x_coordinate(&self) -> Field<E>
pub fn to_x_coordinate(&self) -> Field<E>
Returns the x-coordinate of the group element.
Source§impl<E: Environment> Group<E>
impl<E: Environment> Group<E>
Sourcepub fn to_y_coordinate(&self) -> Field<E>
pub fn to_y_coordinate(&self) -> Field<E>
Returns the y-coordinate of the group element.
Source§impl<E: Environment> Group<E>
impl<E: Environment> Group<E>
Sourcepub fn enforce_double(&self, double: &Group<E>)
pub fn enforce_double(&self, double: &Group<E>)
Enforce that double = 2 * self.
Source§impl<E: Environment> Group<E>
impl<E: Environment> Group<E>
Source§impl<E: Environment> Group<E>
impl<E: Environment> Group<E>
Sourcepub fn enforce_on_curve(&self)
pub fn enforce_on_curve(&self)
Enforces that self
is on the curve.
Ensure ax^2 + y^2 = 1 + dx^2y^2 by checking that y^2 * (dx^2 - 1) = (ax^2 - 1)
Source§impl<E: Environment> Group<E>
impl<E: Environment> Group<E>
Sourcepub fn enforce_in_group(&self)
pub fn enforce_in_group(&self)
Enforces that self
is on the curve and in the largest prime-order subgroup.
Sourcepub fn is_in_group(&self) -> Boolean<E>
pub fn is_in_group(&self) -> Boolean<E>
Returns a Boolean
indicating if self
is in the largest prime-order subgroup,
assuming that self
is on the curve.
Trait Implementations§
Source§impl<E: Environment> Add for Group<E>
impl<E: Environment> Add for Group<E>
Source§impl<E: Environment> AddAssign<&Group<E>> for Group<E>
impl<E: Environment> AddAssign<&Group<E>> for Group<E>
Source§fn add_assign(&mut self, other: &Self)
fn add_assign(&mut self, other: &Self)
+=
operation. Read moreSource§impl<E: Environment> AddAssign for Group<E>
impl<E: Environment> AddAssign for Group<E>
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moreSource§impl<E: Environment> Debug for Group<E>
impl<E: Environment> Debug for Group<E>
Source§impl<E: Environment> Display for Group<E>
impl<E: Environment> Display for Group<E>
Source§impl<E: Environment> Double for Group<E>
impl<E: Environment> Double for Group<E>
Source§impl<E: Environment> Eject for Group<E>
impl<E: Environment> Eject for Group<E>
Source§fn eject_mode(&self) -> Mode
fn eject_mode(&self) -> Mode
Ejects the mode of the group element.
Source§fn eject_value(&self) -> Self::Primitive
fn eject_value(&self) -> Self::Primitive
Ejects the group as a constant group element.
type Primitive = Group<<E as Environment>::Network>
Source§fn eject(&self) -> (Mode, Self::Primitive)
fn eject(&self) -> (Mode, Self::Primitive)
Source§fn is_constant(&self) -> bool
fn is_constant(&self) -> bool
true
if the circuit is a constant.Source§fn is_private(&self) -> bool
fn is_private(&self) -> bool
true
if the circuit is a private.Source§impl<E: Environment> Equal for Group<E>
impl<E: Environment> Equal for Group<E>
Source§fn is_equal(&self, other: &Self) -> Self::Output
fn is_equal(&self, other: &Self) -> Self::Output
Returns true
if self
and other
are equal.
This method costs 8 constraints.
Source§fn is_not_equal(&self, other: &Self) -> Self::Output
fn is_not_equal(&self, other: &Self) -> Self::Output
Returns true
if self
and other
are not equal.
This method constructs a boolean that indicates if
self
and other
are not equal to each other.
This method costs 8 constraints.
type Output = Boolean<E>
Source§impl<E: Environment> From<&Group<E>> for LinearCombination<E::BaseField>
impl<E: Environment> From<&Group<E>> for LinearCombination<E::BaseField>
Source§impl<E: Environment> From<Group<E>> for LinearCombination<E::BaseField>
impl<E: Environment> From<Group<E>> for LinearCombination<E::BaseField>
Source§impl<E: Environment> FromBits for Group<E>
impl<E: Environment> FromBits for Group<E>
Source§fn from_bits_le(bits_le: &[Self::Boolean]) -> Self
fn from_bits_le(bits_le: &[Self::Boolean]) -> Self
Initializes a new group element from the x-coordinate as a list of little-endian bits without trailing zeros.
Source§fn from_bits_be(bits_be: &[Self::Boolean]) -> Self
fn from_bits_be(bits_be: &[Self::Boolean]) -> Self
Initializes a new group element from the x-coordinate as a list of big-endian bits without leading zeros.
type Boolean = Boolean<E>
Source§impl<E: Environment> FromStr for Group<E>
impl<E: Environment> FromStr for Group<E>
Source§impl<E: Environment> Inject for Group<E>
impl<E: Environment> Inject for Group<E>
Source§impl<E: Environment> Metrics<dyn Ternary<Boolean = Boolean<E>, Output = Group<E>>> for Group<E>
impl<E: Environment> Metrics<dyn Ternary<Boolean = Boolean<E>, Output = Group<E>>> for Group<E>
Source§impl<E: Environment> MulAssign<&[Boolean<E>]> for Group<E>
impl<E: Environment> MulAssign<&[Boolean<E>]> for Group<E>
Source§fn mul_assign(&mut self, other: &[Boolean<E>])
fn mul_assign(&mut self, other: &[Boolean<E>])
*=
operation. Read moreSource§impl<E: Environment> MulAssign<&Scalar<E>> for Group<E>
impl<E: Environment> MulAssign<&Scalar<E>> for Group<E>
Source§fn mul_assign(&mut self, other: &Scalar<E>)
fn mul_assign(&mut self, other: &Scalar<E>)
*=
operation. Read moreSource§impl<E: Environment> MulAssign<Scalar<E>> for Group<E>
impl<E: Environment> MulAssign<Scalar<E>> for Group<E>
Source§fn mul_assign(&mut self, other: Scalar<E>)
fn mul_assign(&mut self, other: Scalar<E>)
*=
operation. Read moreSource§impl<E: Environment> Neg for &Group<E>
impl<E: Environment> Neg for &Group<E>
Source§impl<E: Environment> Neg for Group<E>
impl<E: Environment> Neg for Group<E>
Source§impl<E: Environment> OutputMode<dyn Add<Group<E>, Output = Group<E>>> for Group<E>
impl<E: Environment> OutputMode<dyn Add<Group<E>, Output = Group<E>>> for Group<E>
Source§impl<E: Environment> OutputMode<dyn Neg<Output = Group<E>>> for Group<E>
impl<E: Environment> OutputMode<dyn Neg<Output = Group<E>>> for Group<E>
Source§impl<E: Environment> OutputMode<dyn Sub<Group<E>, Output = Group<E>>> for Group<E>
impl<E: Environment> OutputMode<dyn Sub<Group<E>, Output = Group<E>>> for Group<E>
Source§impl<E: Environment> OutputMode<dyn Ternary<Boolean = Boolean<E>, Output = Group<E>>> for Group<E>
impl<E: Environment> OutputMode<dyn Ternary<Boolean = Boolean<E>, Output = Group<E>>> for Group<E>
Source§impl<E: Environment> Parser for Group<E>
impl<E: Environment> Parser for Group<E>
Source§fn parse(string: &str) -> ParserResult<'_, Self>
fn parse(string: &str) -> ParserResult<'_, Self>
Parses a string into a group circuit.
Source§impl<E: Environment> Sub for Group<E>
impl<E: Environment> Sub for Group<E>
Source§impl<E: Environment> SubAssign<&Group<E>> for Group<E>
impl<E: Environment> SubAssign<&Group<E>> for Group<E>
Source§fn sub_assign(&mut self, other: &Self)
fn sub_assign(&mut self, other: &Self)
-=
operation. Read moreSource§impl<E: Environment> SubAssign for Group<E>
impl<E: Environment> SubAssign for Group<E>
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
-=
operation. Read moreSource§impl<E: Environment> Ternary for Group<E>
impl<E: Environment> Ternary for Group<E>
Source§impl<E: Environment> ToBits for &Group<E>
impl<E: Environment> ToBits for &Group<E>
Source§fn write_bits_le(&self, vec: &mut Vec<Self::Boolean>)
fn write_bits_le(&self, vec: &mut Vec<Self::Boolean>)
Outputs the little-endian bit representation of self.x
without trailing zeros.
Source§fn write_bits_be(&self, vec: &mut Vec<Self::Boolean>)
fn write_bits_be(&self, vec: &mut Vec<Self::Boolean>)
Outputs the big-endian bit representation of self.x
without leading zeros.
type Boolean = Boolean<E>
Source§fn to_bits_le(&self) -> Vec<Self::Boolean>
fn to_bits_le(&self) -> Vec<Self::Boolean>
Source§fn to_bits_be(&self) -> Vec<Self::Boolean>
fn to_bits_be(&self) -> Vec<Self::Boolean>
Source§impl<E: Environment> ToBits for Group<E>
impl<E: Environment> ToBits for Group<E>
Source§fn write_bits_le(&self, vec: &mut Vec<Self::Boolean>)
fn write_bits_le(&self, vec: &mut Vec<Self::Boolean>)
Outputs the little-endian bit representation of self.x
without trailing zeros.
Source§fn write_bits_be(&self, vec: &mut Vec<Self::Boolean>)
fn write_bits_be(&self, vec: &mut Vec<Self::Boolean>)
Outputs the big-endian bit representation of self.x
without leading zeros.
type Boolean = Boolean<E>
Source§fn to_bits_le(&self) -> Vec<Self::Boolean>
fn to_bits_le(&self) -> Vec<Self::Boolean>
Source§fn to_bits_be(&self) -> Vec<Self::Boolean>
fn to_bits_be(&self) -> Vec<Self::Boolean>
Source§impl<E: Environment> ToField for Group<E>
impl<E: Environment> ToField for Group<E>
Source§impl<E: Environment> TypeName for Group<E>
impl<E: Environment> TypeName for Group<E>
Source§impl<E: Environment> Zero for Group<E>
impl<E: Environment> Zero for Group<E>
impl<E: Environment> GroupTrait<Scalar<E>> for Group<E>
Auto Trait Implementations§
impl<E> !Freeze for Group<E>
impl<E> RefUnwindSafe for Group<E>
impl<E> !Send for Group<E>
impl<E> !Sync for Group<E>
impl<E> Unpin for Group<E>
impl<E> UnwindSafe for Group<E>
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