pub struct Group<E>
where E: Environment,
{ /* private fields */ }

Implementations§

§

impl<E> Group<E>
where E: Environment,

pub fn from_x_coordinate(x_coordinate: Field<E>) -> Result<Group<E>, Error>

Attempts to recover an affine group element from a given x-coordinate field element. For safety, the resulting point is always enforced to be on the curve and in the correct subgroup.

§

impl<E> Group<E>
where E: Environment,

pub fn from_xy_coordinates(x: Field<E>, y: Field<E>) -> Group<E>

Initializes a new group from the (x, y) affine coordinates.

pub fn from_xy_coordinates_unchecked(x: Field<E>, y: Field<E>) -> Group<E>

Initializes a new group from the (x, y) affine coordinates. Note: The resulting point is not enforced to be on the curve or in the subgroup.

§

impl<E> Group<E>
where E: Environment,

pub fn to_x_coordinate(&self) -> Field<E>

Returns the x-coordinate in the affine coordinates of the group.

§

impl<E> Group<E>
where E: Environment,

pub fn to_xy_coordinates(&self) -> (Field<E>, Field<E>)

Returns the x-coordinate and y-coordinate in the affine coordinates of the group.

§

impl<E> Group<E>
where E: Environment,

pub fn to_y_coordinate(&self) -> Field<E>

Returns the y-coordinate in the affine coordinates of the group.

§

impl<E> Group<E>
where E: Environment,

pub const EDWARDS_A: Field<E> = _

The coefficient A for the twisted Edwards curve equation.

pub const EDWARDS_D: Field<E> = _

The coefficient D for the twisted Edwards curve equation.

pub const MONTGOMERY_A: Field<E> = _

The coefficient A for the Montgomery curve equation.

pub const MONTGOMERY_B: Field<E> = _

The coefficient B for the Montgomery curve equation.

pub fn new(group: <E as Environment>::Affine) -> Group<E>

Initializes a new group.

pub fn generator() -> Group<E>

Returns the prime subgroup generator.

pub fn mul_by_cofactor(&self) -> Group<E>

Returns self * COFACTOR.

pub fn div_by_cofactor(&self) -> Group<E>

Returns self / COFACTOR.

Trait Implementations§

§

impl<E> Add<&Group<E>> for Group<E>
where E: Environment,

§

fn add(self, other: &Group<E>) -> <Group<E> as Add<&Group<E>>>::Output

Returns the sum of self and other.

§

type Output = Group<E>

The resulting type after applying the + operator.
§

impl<E> Add for Group<E>
where E: Environment,

§

fn add(self, other: Group<E>) -> <Group<E> as Add>::Output

Returns the sum of self and other.

§

type Output = Group<E>

The resulting type after applying the + operator.
§

impl<E> AddAssign<&Group<E>> for Group<E>
where E: Environment,

§

fn add_assign(&mut self, other: &Group<E>)

Adds other to self.

§

impl<E> AddAssign for Group<E>
where E: Environment,

§

fn add_assign(&mut self, other: Group<E>)

Adds other to self.

§

impl<E> Clone for Group<E>

§

fn clone(&self) -> Group<E>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<E> Debug for Group<E>
where E: Environment,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<E> Deref for Group<E>
where E: Environment,

§

type Target = <E as Environment>::Projective

The resulting type after dereferencing.
§

fn deref(&self) -> &<Group<E> as Deref>::Target

Dereferences the value.
§

impl<'de, E> Deserialize<'de> for Group<E>
where E: Environment,

§

fn deserialize<D>( deserializer: D ) -> Result<Group<E>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserializes the group from a string or bytes.

§

impl<E> Display for Group<E>
where E: Environment,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<E> Distribution<Group<E>> for Standard
where E: Environment,

§

fn sample<R>(&self, rng: &mut R) -> Group<E>
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
§

impl<E> Double for Group<E>
where E: Environment,

§

fn double(&self) -> <Group<E> as Double>::Output

Returns the double of self.

§

type Output = Group<E>

§

impl<E> Equal for Group<E>
where E: Environment,

§

fn is_equal(&self, other: &Group<E>) -> <Group<E> as Equal>::Output

Returns true if self and other are equal.

§

fn is_not_equal(&self, other: &Group<E>) -> <Group<E> as Equal>::Output

Returns true if self and other are not equal.

§

type Output = Boolean<E>

§

impl<E> FromBits for Group<E>
where E: Environment,

§

fn from_bits_le(bits_le: &[bool]) -> Result<Group<E>, Error>

Initializes a new group by recovering the x-coordinate of an affine group from a list of little-endian bits.

§

fn from_bits_be(bits_be: &[bool]) -> Result<Group<E>, Error>

Initializes a new group by recovering the x-coordinate of an affine group from a list of big-endian bits.

§

impl<E> FromBytes for Group<E>
where E: Environment,

§

fn read_le<R>(reader: R) -> Result<Group<E>, Error>
where R: Read,

Reads the group from a buffer.

source§

fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

Returns Self from a byte array in little-endian order.
§

impl<E> FromField for Group<E>
where E: Environment,

§

fn from_field(field: &<Group<E> as FromField>::Field) -> Result<Group<E>, Error>

Initializes a new group by recovering the x-coordinate of an affine group from a field element.

§

type Field = Field<E>

§

impl<E> FromFields for Group<E>
where E: Environment,

§

fn from_fields( fields: &[<Group<E> as FromFields>::Field] ) -> Result<Group<E>, Error>

Initializes a new group by recovering the x-coordinate of an affine group from a field element.

§

type Field = Field<E>

§

impl<E> FromStr for Group<E>
where E: Environment,

§

fn from_str(string: &str) -> Result<Group<E>, Error>

Parses a string into a group.

§

type Err = Error

The associated error which can be returned from parsing.
§

impl<E> Hash for Group<E>

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<E> Mul<&Group<E>> for Scalar<E>
where E: Environment,

§

fn mul(self, other: &Group<E>) -> <Scalar<E> as Mul<&Group<E>>>::Output

Returns the product of self and other.

§

type Output = Group<E>

The resulting type after applying the * operator.
§

impl<E> Mul<&Scalar<E>> for Group<E>
where E: Environment,

§

fn mul(self, other: &Scalar<E>) -> <Group<E> as Mul<&Scalar<E>>>::Output

Returns the product of self and other.

§

type Output = Group<E>

The resulting type after applying the * operator.
§

impl<E> Mul<Group<E>> for Scalar<E>
where E: Environment,

§

fn mul(self, other: Group<E>) -> <Scalar<E> as Mul<Group<E>>>::Output

Returns the product of self and other.

§

type Output = Group<E>

The resulting type after applying the * operator.
§

impl<E> Mul<Scalar<E>> for Group<E>
where E: Environment,

§

fn mul(self, other: Scalar<E>) -> <Group<E> as Mul<Scalar<E>>>::Output

Returns the product of self and other.

§

type Output = Group<E>

The resulting type after applying the * operator.
§

impl<E> MulAssign<&Scalar<E>> for Group<E>
where E: Environment,

§

fn mul_assign(&mut self, other: &Scalar<E>)

Multiplies self by other.

§

impl<E> MulAssign<Scalar<E>> for Group<E>
where E: Environment,

§

fn mul_assign(&mut self, other: Scalar<E>)

Multiplies self by other.

§

impl<E> Neg for Group<E>
where E: Environment,

§

fn neg(self) -> <Group<E> as Neg>::Output

Returns the negation of self.

§

type Output = Group<E>

The resulting type after applying the - operator.
§

impl<E> Parser for Group<E>
where E: Environment,

§

fn parse(string: &str) -> Result<(&str, Group<E>), Err<VerboseError<&str>>>

Parses a string into a group circuit.

§

impl<E> PartialEq for Group<E>

§

fn eq(&self, other: &Group<E>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<E> Serialize for Group<E>
where E: Environment,

§

fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serializes the group into a string or as bytes.

§

impl<E> SizeInBits for Group<E>
where E: Environment,

§

fn size_in_bits() -> usize

Returns the group size in bits.

§

impl<E> SizeInBytes for Group<E>
where E: Environment,

§

fn size_in_bytes() -> usize

Returns the group size in bytes.

§

impl<E> Sub<&Group<E>> for Group<E>
where E: Environment,

§

fn sub(self, other: &Group<E>) -> <Group<E> as Sub<&Group<E>>>::Output

Returns the difference of self and other.

§

type Output = Group<E>

The resulting type after applying the - operator.
§

impl<E> Sub for Group<E>
where E: Environment,

§

fn sub(self, other: Group<E>) -> <Group<E> as Sub>::Output

Returns the difference of self and other.

§

type Output = Group<E>

The resulting type after applying the - operator.
§

impl<E> SubAssign<&Group<E>> for Group<E>
where E: Environment,

§

fn sub_assign(&mut self, other: &Group<E>)

Subtracts other from self.

§

impl<E> SubAssign for Group<E>
where E: Environment,

§

fn sub_assign(&mut self, other: Group<E>)

Subtracts other from self.

§

impl<'a, E> Sum<&'a Group<E>> for Group<E>
where E: Environment,

§

fn sum<I>(iter: I) -> Group<E>
where I: Iterator<Item = &'a Group<E>>,

Returns the sum of self and other.

§

impl<E> Sum for Group<E>
where E: Environment,

§

fn sum<I>(iter: I) -> Group<E>
where I: Iterator<Item = Group<E>>,

Returns the sum of self and other.

§

impl<E> Ternary for Group<E>
where E: Environment,

§

fn ternary( condition: &<Group<E> as Ternary>::Boolean, first: &Group<E>, second: &Group<E> ) -> <Group<E> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

§

type Boolean = Boolean<E>

§

type Output = Group<E>

§

impl<E> ToBits for Group<E>
where E: Environment,

§

fn write_bits_le(&self, vec: &mut Vec<bool>)

Outputs the little-endian bit representation of self.to_x_coordinate() without trailing zeros.

§

fn write_bits_be(&self, vec: &mut Vec<bool>)

Outputs the big-endian bit representation of self.to_x_coordinate() without leading zeros.

source§

fn to_bits_le(&self) -> Vec<bool>

Returns self as a boolean array in little-endian order.
source§

fn to_bits_be(&self) -> Vec<bool>

Returns self as a boolean array in big-endian order.
source§

fn num_bits() -> Option<usize>

An optional indication of how many bits an object can be represented with.
§

impl<E> ToBytes for Group<E>
where E: Environment,

§

fn write_le<W>(&self, writer: W) -> Result<(), Error>
where W: Write,

Writes the group to a buffer.

source§

fn to_bytes_le(&self) -> Result<Vec<u8>, Error>
where Self: Sized,

Returns self as a byte array in little-endian order.
§

impl<E> ToField for Group<E>
where E: Environment,

§

fn to_field(&self) -> Result<<Group<E> as ToField>::Field, Error>

Returns the group as a field element.

§

type Field = Field<E>

§

impl<E> ToFields for Group<E>
where E: Environment,

§

fn to_fields(&self) -> Result<Vec<<Group<E> as ToFields>::Field>, Error>

Returns the group as field elements.

§

type Field = Field<E>

§

impl<E> TypeName for Group<E>
where E: Environment,

§

fn type_name() -> &'static str

Returns the type name as a string.

§

impl<E> Visibility for Group<E>
where E: Environment,

§

fn size_in_fields(&self) -> Result<u16, Error>

Returns the number of field elements to encode self.

§

type Boolean = Boolean<E>

§

impl<E> Zero for Group<E>
where E: Environment,

§

fn zero() -> Group<E>

Returns the 0 element of the group.

§

fn is_zero(&self) -> bool

Returns true if the element is zero.

source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
§

impl<E> Copy for Group<E>

§

impl<E> Eq for Group<E>
where E: Eq + Environment, <E as Environment>::Projective: Eq,

§

impl<E> GroupTrait<Scalar<E>> for Group<E>
where E: Environment,

§

impl<E> StructuralPartialEq for Group<E>
where E: Environment,

Auto Trait Implementations§

§

impl<E> RefUnwindSafe for Group<E>

§

impl<E> Send for Group<E>

§

impl<E> Sync for Group<E>

§

impl<E> Unpin for Group<E>
where <E as Environment>::Projective: Unpin,

§

impl<E> UnwindSafe for Group<E>

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<'de, T> DeserializeExt<'de> for T

source§

fn take_from_value<D>( value: &mut Value, field: &str ) -> Result<T, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

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
§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

§

fn to_smolstr(&self) -> SmolStr

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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

impl<T> Uniform for T

source§

fn rand<R>(rng: &mut R) -> T
where R: Rng + ?Sized,

Samples a random value from a uniform distribution.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,