decaf377

Struct Element

Source
pub struct Element { /* private fields */ }

Implementations§

Source§

impl Element

Source

pub const GENERATOR: Self = _

Return the conventional generator for decaf377.

Source

pub const IDENTITY: Self = _

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 encode_to_curve(r: &Fq) -> Element

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

Source§

impl Element

Trait Implementations§

Source§

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

Source§

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<'b> Add<&'b Element> for Element

Source§

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<Element> for &'a Element

Source§

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

Source§

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

Source§

type Output = Element

The resulting type after applying the + operator.
Source§

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

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

Source§

type Config = Decaf377EdwardsConfig

Source§

type BaseField = Fq

The field over which this curve is defined.
Source§

type Affine = AffinePoint

The affine representation of this element.
Source§

type FullGroup = AffinePoint

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

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

Normalizes a slice of group elements into affine.
Source§

fn into_affine(self) -> Self::Affine

Converts self into the affine representation.
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<&Element> for Encoding

Source§

fn from(point: &Element) -> 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 Encoding

Source§

fn from(point: Element) -> Self

Converts to this type from the input type.
Source§

impl Group for Element

Source§

type ScalarField = Fr

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Performs the *= operation. Read more
Source§

impl MulAssign<Fr> for Element

Source§

fn mul_assign(&mut self, other: Fr)

Performs the *= operation. Read more
Source§

impl Neg for Element

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

impl ScalarMul for Element

Source§

const NEGATION_IS_CHEAP: bool = true

Source§

type MulBase = AffinePoint

Source§

fn batch_convert_to_mul_base(bases: &[Self]) -> Vec<Self::MulBase>

Source§

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

Source§

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

Source§

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<'a> Sub<Element> for &'a Element

Source§

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

Source§

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

Source§

type Output = Element

The resulting type after applying the - operator.
Source§

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

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

Source§

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

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

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl TryFrom<&[u8]> for Element

Source§

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

Source§

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

Source§

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

Source§

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,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

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

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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§

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

Source§

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

Source§

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,