Struct decaf377::Element

source ·
pub struct Element { /* private fields */ }

Implementations§

source§

impl Element

source

pub fn is_identity(&self) -> bool

Convenience method to make identity checks more readable.

source

pub fn vartime_multiscalar_mul<I, J>(scalars: I, points: J) -> Element

Given an iterator of public scalars and an iterator of public points, compute $$ Q = [c_1] P_1 + \cdots + [c_n] P_n, $$ using variable-time operations.

It is an error to call this function with two iterators of different lengths – it would require ExactSizeIterator, but ExactSizeIterators are not closed under chaining, and disallowing iterator chaining would destroy the utility of the function.

source§

impl Element

source

pub fn hash_to_curve(r_1: &Fq, r_2: &Fq) -> Element

Maps two field elements to a uniformly distributed decaf377 Element.

The two field elements provided as inputs should be independently chosen.

source

pub fn map_to_group_uniform(r_1: &Fq, r_2: &Fq) -> Element

👎Deprecated: please use hash_to_curve instead
source

pub fn encode_to_curve(r: &Fq) -> Element

Maps a field element to a decaf377 Element suitable for CDH challenges.

source

pub fn map_to_group_cdh(r: &Fq) -> Element

👎Deprecated: please use encode_to_curve instead
source§

impl Element

source

pub fn compress_to_field(&self) -> Fq

👎Deprecated: please use vartime_compress_to_field instead
source

pub fn vartime_compress_to_field(&self) -> Fq

source

pub fn compress(&self) -> Encoding

👎Deprecated: please use vartime_compress instead
source

pub fn vartime_compress(&self) -> Encoding

Trait Implementations§

source§

impl<'a> Add<&'a AffineElement> for Element

§

type Output = Element

The resulting type after applying the + operator.
source§

fn add(self, other: &'a AffineElement) -> Element

Performs the + operation. Read more
source§

impl<'a, 'b> Add<&'b Element> for &'a Element

§

type Output = Element

The resulting type after applying the + operator.
source§

fn add(self, other: &'b Element) -> Element

Performs the + operation. Read more
source§

impl<'a> Add<&'a Element> for AffineElement

§

type Output = Element

The resulting type after applying the + operator.
source§

fn add(self, other: &'a Element) -> Element

Performs the + operation. Read more
source§

impl<'b> Add<&'b Element> for Element

§

type Output = Element

The resulting type after applying the + operator.
source§

fn add(self, other: &'b Element) -> Element

Performs the + operation. Read more
source§

impl Add<AffineElement> for Element

§

type Output = Element

The resulting type after applying the + operator.
source§

fn add(self, other: AffineElement) -> Element

Performs the + operation. Read more
source§

impl<'a> Add<Element> for &'a Element

§

type Output = Element

The resulting type after applying the + operator.
source§

fn add(self, other: Element) -> Element

Performs the + operation. Read more
source§

impl Add<Element> for AffineElement

§

type Output = Element

The resulting type after applying the + operator.
source§

fn add(self, other: Element) -> Element

Performs the + operation. Read more
source§

impl Add<Element> for ElementVar

§

type Output = ElementVar

The resulting type after applying the + operator.
source§

fn add(self, other: Element) -> Self::Output

Performs the + operation. Read more
source§

impl Add for Element

§

type Output = Element

The resulting type after applying the + operator.
source§

fn add(self, other: Element) -> Element

Performs the + operation. Read more
source§

impl<'a> AddAssign<&'a AffineElement> for Element

source§

fn add_assign(&mut self, other: &'a AffineElement)

Performs the += operation. Read more
source§

impl<'b> AddAssign<&'b Element> for Element

source§

fn add_assign(&mut self, other: &'b Element)

Performs the += operation. Read more
source§

impl AddAssign<AffineElement> for Element

source§

fn add_assign(&mut self, other: AffineElement)

Performs the += operation. Read more
source§

impl AddAssign<Element> for ElementVar

source§

fn add_assign(&mut self, rhs: Element)

Performs the += operation. Read more
source§

impl AddAssign for Element

source§

fn add_assign(&mut self, other: Element)

Performs the += operation. Read more
source§

impl AllocVar<Element, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar

source§

fn new_variable<T: Borrow<Element>>( cs: impl Into<Namespace<Fq>>, f: impl FnOnce() -> Result<T, SynthesisError>, mode: AllocationMode ) -> Result<Self, SynthesisError>

Allocates a new variable of type Self in the ConstraintSystem cs. The mode of allocation is decided by mode.
§

fn new_constant( cs: impl Into<Namespace<F>>, t: impl Borrow<V> ) -> Result<Self, SynthesisError>

Allocates a new constant of type Self in the ConstraintSystem cs. Read more
§

fn new_input<T>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError> ) -> Result<Self, SynthesisError>
where T: Borrow<V>,

Allocates a new public input of type Self in the ConstraintSystem cs.
§

fn new_witness<T>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError> ) -> Result<Self, SynthesisError>
where T: Borrow<V>,

Allocates a new private witness of type Self in the ConstraintSystem cs.
source§

impl CanonicalDeserialize for Element

source§

fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate ) -> Result<Self, SerializationError>

The general deserialize method that takes in customization flags.
source§

fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>
where R: Read,

source§

fn deserialize_compressed_unchecked<R>( reader: R ) -> Result<Self, SerializationError>
where R: Read,

source§

fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>
where R: Read,

source§

fn deserialize_uncompressed_unchecked<R>( reader: R ) -> Result<Self, SerializationError>
where R: Read,

source§

impl CanonicalSerialize for Element

source§

fn serialized_size(&self, compress: Compress) -> usize

source§

fn serialize_with_mode<W: Write>( &self, writer: W, mode: Compress ) -> Result<(), SerializationError>

The general serialize method that takes in customization flags.
source§

fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>
where W: Write,

source§

fn compressed_size(&self) -> usize

source§

fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>
where W: Write,

source§

fn uncompressed_size(&self) -> usize

source§

impl Clone for Element

source§

fn clone(&self) -> Element

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 CurveGroup for Element

§

type Config = EdwardsConfig

§

type BaseField = Fp<MontBackend<FrConfig, 4>, 4>

The field over which this curve is defined.
§

type Affine = AffineElement

The affine representation of this element.
§

type FullGroup = AffineElement

Type representing an element of the full elliptic curve group, not just the prime order subgroup.
source§

fn normalize_batch(v: &[Self]) -> Vec<AffineElement>

Normalizes a slice of group elements into affine.
source§

fn into_affine(self) -> Self::Affine

Converts self into the affine representation.
source§

impl CurveVar<Element, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar

source§

fn zero() -> Self

Returns the constant F::zero(). This is the identity of the group.
source§

fn constant(other: Element) -> Self

Returns a constant with value v. Read more
source§

fn new_variable_omit_prime_order_check( cs: impl Into<Namespace<Fq>>, f: impl FnOnce() -> Result<Element, SynthesisError>, mode: AllocationMode ) -> Result<Self, SynthesisError>

Allocates a variable in the subgroup without checking if it’s in the prime-order subgroup.
source§

fn enforce_prime_order(&self) -> Result<(), SynthesisError>

Enforce that self is in the prime-order subgroup.
source§

fn double_in_place(&mut self) -> Result<(), SynthesisError>

Sets self = self + self.
source§

fn negate(&self) -> Result<Self, SynthesisError>

Coputes -self.
§

fn is_zero(&self) -> Result<Boolean<ConstraintF>, SynthesisError>

Returns a Boolean representing whether self == Self::zero().
§

fn double(&self) -> Result<Self, SynthesisError>

Computes self + self.
§

fn scalar_mul_le<'a>( &self, bits: impl Iterator<Item = &'a Boolean<ConstraintF>> ) -> Result<Self, SynthesisError>

Computes bits * self, where bits is a little-endian Boolean representation of a scalar.
§

fn precomputed_base_scalar_mul_le<'a, I, B>( &mut self, scalar_bits_with_bases: I ) -> Result<(), SynthesisError>
where I: Iterator<Item = (B, &'a C)>, B: Borrow<Boolean<ConstraintF>>, C: 'a,

Computes a I * self in place, where I is a Boolean little-endian representation of the scalar. Read more
§

fn precomputed_base_multiscalar_mul_le<'a, T, I, B>( bases: &[B], scalars: I ) -> Result<Self, SynthesisError>
where T: 'a + ToBitsGadget<ConstraintF> + ?Sized, I: Iterator<Item = &'a T>, B: Borrow<[C]>,

Computes Σⱼ(scalarⱼ * baseⱼ) for all j, where scalarⱼ is a Boolean little-endian representation of the j-th scalar.
source§

impl Debug for Element

source§

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

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

impl Default for Element

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for Element

source§

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

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

impl Distribution<Element> for Standard

source§

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

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 From<&AffineElement> for Element

source§

fn from(point: &AffineElement) -> Self

Converts to this type from the input type.
source§

impl From<&Element> for AffineElement

source§

fn from(point: &Element) -> Self

Converts to this type from the input type.
source§

impl From<&Element> for Encoding

source§

fn from(point: &Element) -> Self

Converts to this type from the input type.
source§

impl From<AffineElement> for Element

source§

fn from(point: AffineElement) -> Self

Converts to this type from the input type.
source§

impl From<Element> for [u8; 32]

source§

fn from(enc: Element) -> [u8; 32]

Converts to this type from the input type.
source§

impl From<Element> for AffineElement

source§

fn from(point: Element) -> Self

Converts to this type from the input type.
source§

impl From<Element> for Encoding

source§

fn from(point: Element) -> Self

Converts to this type from the input type.
source§

impl Group for Element

§

type ScalarField = Fp<MontBackend<FrConfig, 4>, 4>

The scalar field F_r, where r is the order of this group.
source§

fn double_in_place(&mut self) -> &mut Self

Double self in place.
source§

fn generator() -> Self

Returns a fixed generator of this group.
source§

fn mul_bigint(&self, other: impl AsRef<[u64]>) -> Self

Performs scalar multiplication of this element.
§

fn double(&self) -> Self

Doubles self.
§

fn mul_bits_be(&self, other: impl Iterator<Item = bool>) -> Self

Computes other * self, where other is a big-endian bit representation of some integer.
source§

impl Hash for Element

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<'a, 'b> Mul<&'b Element> for &'a Fr

§

type Output = Element

The resulting type after applying the * operator.
source§

fn mul(self, point: &'b Element) -> Element

Performs the * operation. Read more
source§

impl<'b> Mul<&'b Element> for Fr

§

type Output = Element

The resulting type after applying the * operator.
source§

fn mul(self, other: &'b Element) -> Element

Performs the * operation. Read more
source§

impl<'a, 'b> Mul<&'b Fp<MontBackend<FrConfig, 4>, 4>> for &'a Element

§

type Output = Element

The resulting type after applying the * operator.
source§

fn mul(self, point: &'b Fr) -> Element

Performs the * operation. Read more
source§

impl<'b> Mul<&'b Fp<MontBackend<FrConfig, 4>, 4>> for Element

§

type Output = Element

The resulting type after applying the * operator.
source§

fn mul(self, other: &'b Fr) -> Element

Performs the * operation. Read more
source§

impl<'a> Mul<Element> for &'a Fr

§

type Output = Element

The resulting type after applying the * operator.
source§

fn mul(self, other: Element) -> Element

Performs the * operation. Read more
source§

impl Mul<Element> for Fr

§

type Output = Element

The resulting type after applying the * operator.
source§

fn mul(self, other: Element) -> Element

Performs the * operation. Read more
source§

impl<'a> Mul<Fp<MontBackend<FrConfig, 4>, 4>> for &'a Element

§

type Output = Element

The resulting type after applying the * operator.
source§

fn mul(self, other: Fr) -> Element

Performs the * operation. Read more
source§

impl Mul<Fp<MontBackend<FrConfig, 4>, 4>> for Element

§

type Output = Element

The resulting type after applying the * operator.
source§

fn mul(self, other: Fr) -> Element

Performs the * operation. Read more
source§

impl<'b> MulAssign<&'b Fp<MontBackend<FrConfig, 4>, 4>> for Element

source§

fn mul_assign(&mut self, point: &'b Fr)

Performs the *= operation. Read more
source§

impl MulAssign<Fp<MontBackend<FrConfig, 4>, 4>> for Element

source§

fn mul_assign(&mut self, other: Fr)

Performs the *= operation. Read more
source§

impl Neg for Element

§

type Output = Element

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl PartialEq for Element

source§

fn eq(&self, other: &Element) -> 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 ScalarMul for Element

source§

impl<'a> Sub<&'a AffineElement> for Element

§

type Output = Element

The resulting type after applying the - operator.
source§

fn sub(self, other: &'a AffineElement) -> Element

Performs the - operation. Read more
source§

impl<'a, 'b> Sub<&'b Element> for &'a Element

§

type Output = Element

The resulting type after applying the - operator.
source§

fn sub(self, other: &'b Element) -> Element

Performs the - operation. Read more
source§

impl<'b> Sub<&'b Element> for Element

§

type Output = Element

The resulting type after applying the - operator.
source§

fn sub(self, other: &'b Element) -> Element

Performs the - operation. Read more
source§

impl Sub<AffineElement> for Element

§

type Output = Element

The resulting type after applying the - operator.
source§

fn sub(self, other: AffineElement) -> Element

Performs the - operation. Read more
source§

impl<'a> Sub<Element> for &'a Element

§

type Output = Element

The resulting type after applying the - operator.
source§

fn sub(self, other: Element) -> Element

Performs the - operation. Read more
source§

impl Sub<Element> for ElementVar

§

type Output = ElementVar

The resulting type after applying the - operator.
source§

fn sub(self, other: Element) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for Element

§

type Output = Element

The resulting type after applying the - operator.
source§

fn sub(self, other: Element) -> Element

Performs the - operation. Read more
source§

impl<'a> SubAssign<&'a AffineElement> for Element

source§

fn sub_assign(&mut self, other: &'a AffineElement)

Performs the -= operation. Read more
source§

impl<'b> SubAssign<&'b Element> for Element

source§

fn sub_assign(&mut self, other: &'b Element)

Performs the -= operation. Read more
source§

impl SubAssign<AffineElement> for Element

source§

fn sub_assign(&mut self, other: AffineElement)

Performs the -= operation. Read more
source§

impl SubAssign<Element> for ElementVar

source§

fn sub_assign(&mut self, rhs: Element)

Performs the -= operation. Read more
source§

impl SubAssign for Element

source§

fn sub_assign(&mut self, other: Element)

Performs the -= operation. Read more
source§

impl<'a> Sum<&'a AffineElement> for Element

source§

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

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<'a> Sum<&'a Element> for Element

source§

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

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl Sum<AffineElement> for Element

source§

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

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl Sum for Element

source§

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

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl ToConstraintField<Fp<MontBackend<FrConfig, 4>, 4>> for Element

source§

impl TryFrom<&[u8]> for Element

§

type Error = EncodingError

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl TryFrom<&Encoding> for Element

§

type Error = EncodingError

The type returned in the event of a conversion error.
source§

fn try_from(bytes: &Encoding) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<[u8; 32]> for Element

§

type Error = EncodingError

The type returned in the event of a conversion error.
source§

fn try_from(bytes: [u8; 32]) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Encoding> for Element

§

type Error = EncodingError

The type returned in the event of a conversion error.
source§

fn try_from(bytes: Encoding) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Valid for Element

source§

fn check(&self) -> Result<(), SerializationError>

source§

fn batch_check<'a>( batch: impl Iterator<Item = &'a Self> + Send ) -> Result<(), SerializationError>
where Self: 'a,

source§

impl VariableBaseMSM for Element

§

fn msm_unchecked(bases: &[Self::MulBase], scalars: &[Self::ScalarField]) -> Self

Computes an inner product between the PrimeField elements in scalars and the corresponding group elements in bases. Read more
§

fn msm( bases: &[Self::MulBase], scalars: &[Self::ScalarField] ) -> Result<Self, usize>

Performs multi-scalar multiplication, without checking that bases.len() == scalars.len(). Read more
§

fn msm_bigint( bases: &[Self::MulBase], bigints: &[<Self::ScalarField as PrimeField>::BigInt] ) -> Self

Optimized implementation of multi-scalar multiplication.
§

fn msm_chunks<I, J>(bases_stream: &J, scalars_stream: &I) -> Self
where I: Iterable + ?Sized, <I as Iterable>::Item: Borrow<Self::ScalarField>, J: Iterable, <J as Iterable>::Item: Borrow<Self::MulBase>,

Streaming multi-scalar multiplication algorithm with hard-coded chunk size.
source§

impl Zero for Element

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

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

impl Zeroize for Element

source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
source§

impl Copy for Element

source§

impl Eq for Element

source§

impl<'a> GroupOpsBounds<'a, Element, ElementVar> for ElementVar

Auto Trait Implementations§

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> CanonicalSerializeHashExt for T

source§

fn hash<H>(&self) -> GenericArray<u8, <H as OutputSizeUser>::OutputSize>
where H: Digest,

source§

fn hash_uncompressed<H>( &self ) -> GenericArray<u8, <H as OutputSizeUser>::OutputSize>
where H: Digest,

§

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
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
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.
§

impl<T> UniformRand for T

§

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

§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T, F> DomainCoeff<F> for T
where F: FftField, T: Copy + Send + Sync + Add<Output = T> + Sub<Output = T> + AddAssign + SubAssign + Zero + MulAssign<F> + Debug + PartialEq,