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

Implementations§

source§

impl<E: Environment> Group<E>

source

pub fn from_x_coordinate(x_coordinate: Field<E>) -> Result<Self>

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.

source§

impl<E: Environment> Group<E>

source

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

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

source

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

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.

source§

impl<E: Environment> Group<E>

source

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

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

source§

impl<E: Environment> Group<E>

source

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

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

source§

impl<E: Environment> Group<E>

source

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

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

source§

impl<E: Environment> Group<E>

source

pub const EDWARDS_A: Field<E> = _

The coefficient A for the twisted Edwards curve equation.

source

pub const EDWARDS_D: Field<E> = _

The coefficient D for the twisted Edwards curve equation.

source

pub const MONTGOMERY_A: Field<E> = _

The coefficient A for the Montgomery curve equation.

source

pub const MONTGOMERY_B: Field<E> = _

The coefficient B for the Montgomery curve equation.

source

pub fn new(group: E::Affine) -> Self

Initializes a new group.

source

pub fn generator() -> Self

Returns the prime subgroup generator.

source

pub fn mul_by_cofactor(&self) -> Self

Returns self * COFACTOR.

source

pub fn div_by_cofactor(&self) -> Self

Returns self / COFACTOR.

Trait Implementations§

source§

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

source§

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

Returns the sum of self and other.

§

type Output = Group<E>

The resulting type after applying the + operator.
source§

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

source§

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

Returns the sum of self and other.

§

type Output = Group<E>

The resulting type after applying the + operator.
source§

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

source§

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

Adds other to self.

source§

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

source§

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

Adds other to self.

source§

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

source§

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

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

source§

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

Formats the value using the given formatter. Read more
source§

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

§

type Target = <E as Environment>::Projective

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

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

source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserializes the group from a string or bytes.

source§

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

source§

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

Formats the value using the given formatter. Read more
source§

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

source§

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

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

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

source§

fn double(&self) -> Self::Output

Returns the double of self.

§

type Output = Group<E>

source§

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

source§

fn is_equal(&self, other: &Self) -> Self::Output

Returns true if self and other are equal.

source§

fn is_not_equal(&self, other: &Self) -> Self::Output

Returns true if self and other are not equal.

§

type Output = Boolean<E>

source§

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

source§

fn from_bits_le(bits_le: &[bool]) -> Result<Self>

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

source§

fn from_bits_be(bits_be: &[bool]) -> Result<Self>

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

source§

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

source§

fn read_le<R: Read>(reader: R) -> IoResult<Self>

Reads the group from a buffer.

§

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

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

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

source§

fn from_field(field: &Self::Field) -> Result<Self>

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

§

type Field = Field<E>

source§

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

source§

fn from_fields(fields: &[Self::Field]) -> Result<Self>

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

§

type Field = Field<E>

source§

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

source§

fn from_str(string: &str) -> Result<Self>

Parses a string into a group.

§

type Err = Error

The associated error which can be returned from parsing.
source§

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

source§

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

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

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

source§

fn mul(self, other: &Group<E>) -> Self::Output

Returns the product of self and other.

§

type Output = Group<E>

The resulting type after applying the * operator.
source§

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

source§

fn mul(self, other: &Scalar<E>) -> Self::Output

Returns the product of self and other.

§

type Output = Group<E>

The resulting type after applying the * operator.
source§

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

source§

fn mul(self, other: Group<E>) -> Self::Output

Returns the product of self and other.

§

type Output = Group<E>

The resulting type after applying the * operator.
source§

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

source§

fn mul(self, other: Scalar<E>) -> Self::Output

Returns the product of self and other.

§

type Output = Group<E>

The resulting type after applying the * operator.
source§

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

source§

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

Multiplies self by other.

source§

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

source§

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

Multiplies self by other.

source§

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

source§

fn neg(self) -> Self::Output

Returns the negation of self.

§

type Output = Group<E>

The resulting type after applying the - operator.
source§

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

source§

fn parse(string: &str) -> ParserResult<'_, Self>

Parses a string into a group circuit.

source§

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

source§

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

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

source§

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

Serializes the group into a string or as bytes.

source§

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

source§

fn size_in_bits() -> usize

Returns the group size in bits.

source§

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

source§

fn size_in_bytes() -> usize

Returns the group size in bytes.

source§

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

source§

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

Returns the difference of self and other.

§

type Output = Group<E>

The resulting type after applying the - operator.
source§

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

source§

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

Returns the difference of self and other.

§

type Output = Group<E>

The resulting type after applying the - operator.
source§

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

source§

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

Subtracts other from self.

source§

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

source§

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

Subtracts other from self.

source§

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

source§

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

Returns the sum of self and other.

source§

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

source§

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

Returns the sum of self and other.

source§

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

source§

fn ternary( condition: &Self::Boolean, first: &Self, second: &Self ) -> Self::Output

Returns first if condition is true, otherwise returns second.

§

type Boolean = Boolean<E>

§

type Output = Group<E>

source§

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

source§

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

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

source§

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

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

source§

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

source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Writes the group to a buffer.

§

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

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

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

source§

fn to_field(&self) -> Result<Self::Field>

Returns the group as a field element.

§

type Field = Field<E>

source§

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

source§

fn to_fields(&self) -> Result<Vec<Self::Field>>

Returns the group as field elements.

§

type Field = Field<E>

source§

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

source§

fn type_name() -> &'static str

Returns the type name as a string.

source§

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

source§

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

Returns the number of field elements to encode self.

§

type Boolean = Boolean<E>

source§

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

source§

fn zero() -> Self

Returns the 0 element of the group.

source§

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

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

source§

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

source§

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

source§

impl<E: Environment> StructuralEq for Group<E>

source§

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

Auto Trait Implementations§

§

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

§

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>where <E as Environment>::Projective: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<'de, T> DeserializeExt<'de> for Twhere T: DeserializeOwned,

§

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 Qwhere 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 Qwhere 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 Twhere 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 = mem::align_of::<T>()

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

impl<T> ToString for Twhere 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 Twhere 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 Twhere 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.
§

impl<T> Uniform for Twhere Standard: Distribution<T>,

§

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

Samples a random value from a uniform distribution.
§

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

§

fn vzip(self) -> V

source§

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