pub struct Element { /* private fields */ }
Implementations§
Source§impl Element
impl Element
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Convenience method to make identity checks more readable.
Sourcepub fn vartime_multiscalar_mul<I, J>(scalars: I, points: J) -> Element
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
ExactSizeIterator
s are not closed under chaining, and disallowing
iterator chaining would destroy the utility of the function.
Source§impl Element
impl Element
Sourcepub fn hash_to_curve(r_1: &Fq, r_2: &Fq) -> Element
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.
Sourcepub fn encode_to_curve(r: &Fq) -> Element
pub fn encode_to_curve(r: &Fq) -> Element
Maps a field element to a decaf377 Element
suitable for CDH challenges.
Trait Implementations§
Source§impl Add<Element> for ElementVar
impl Add<Element> for ElementVar
Source§impl<'b> AddAssign<&'b Element> for Element
impl<'b> AddAssign<&'b Element> for Element
Source§fn add_assign(&mut self, other: &'b Element)
fn add_assign(&mut self, other: &'b Element)
Performs the
+=
operation. Read moreSource§impl AddAssign<Element> for ElementVar
impl AddAssign<Element> for ElementVar
Source§fn add_assign(&mut self, rhs: Element)
fn add_assign(&mut self, rhs: Element)
Performs the
+=
operation. Read moreSource§impl AddAssign for Element
impl AddAssign for Element
Source§fn add_assign(&mut self, other: Element)
fn add_assign(&mut self, other: Element)
Performs the
+=
operation. Read moreSource§impl CanonicalDeserialize for Element
impl CanonicalDeserialize for Element
Source§fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
The general deserialize method that takes in customization flags.
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
Source§impl CanonicalSerialize for Element
impl CanonicalSerialize for Element
fn serialized_size(&self, compress: Compress) -> usize
Source§fn serialize_with_mode<W: Write>(
&self,
writer: W,
mode: Compress,
) -> Result<(), SerializationError>
fn serialize_with_mode<W: Write>( &self, writer: W, mode: Compress, ) -> Result<(), SerializationError>
The general serialize method that takes in customization flags.
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn compressed_size(&self) -> usize
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn uncompressed_size(&self) -> usize
Source§impl CurveGroup for Element
impl CurveGroup for Element
type Config = Decaf377EdwardsConfig
Source§type FullGroup = AffinePoint
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>
fn normalize_batch(v: &[Self]) -> Vec<AffinePoint>
Normalizes a slice of group elements into affine.
Source§fn into_affine(self) -> Self::Affine
fn into_affine(self) -> Self::Affine
Converts
self
into the affine representation.Source§impl Distribution<Element> for Standard
impl Distribution<Element> for Standard
Source§impl Group for Element
impl Group for Element
Source§type ScalarField = Fr
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
fn double_in_place(&mut self) -> &mut Self
Double
self
in place.Source§fn mul_bigint(&self, other: impl AsRef<[u64]>) -> Self
fn mul_bigint(&self, other: impl AsRef<[u64]>) -> Self
Performs scalar multiplication of this element.
§fn mul_bits_be(&self, other: impl Iterator<Item = bool>) -> 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<'b> MulAssign<&'b Fr> for Element
impl<'b> MulAssign<&'b Fr> for Element
Source§fn mul_assign(&mut self, point: &'b Fr)
fn mul_assign(&mut self, point: &'b Fr)
Performs the
*=
operation. Read moreSource§impl MulAssign<Fr> for Element
impl MulAssign<Fr> for Element
Source§fn mul_assign(&mut self, other: Fr)
fn mul_assign(&mut self, other: Fr)
Performs the
*=
operation. Read moreSource§impl Sub<Element> for ElementVar
impl Sub<Element> for ElementVar
Source§impl<'b> SubAssign<&'b Element> for Element
impl<'b> SubAssign<&'b Element> for Element
Source§fn sub_assign(&mut self, other: &'b Element)
fn sub_assign(&mut self, other: &'b Element)
Performs the
-=
operation. Read moreSource§impl SubAssign<Element> for ElementVar
impl SubAssign<Element> for ElementVar
Source§fn sub_assign(&mut self, rhs: Element)
fn sub_assign(&mut self, rhs: Element)
Performs the
-=
operation. Read moreSource§impl SubAssign for Element
impl SubAssign for Element
Source§fn sub_assign(&mut self, other: Element)
fn sub_assign(&mut self, other: Element)
Performs the
-=
operation. Read moreSource§impl Valid for Element
impl Valid for Element
fn check(&self) -> Result<(), SerializationError>
fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
Source§impl VariableBaseMSM for Element
impl VariableBaseMSM for Element
§fn msm_unchecked(bases: &[Self::MulBase], scalars: &[Self::ScalarField]) -> Self
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>
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
fn msm_bigint( bases: &[Self::MulBase], bigints: &[<Self::ScalarField as PrimeField>::BigInt], ) -> Self
Optimized implementation of multi-scalar multiplication.
impl Copy for Element
impl Eq for Element
impl<'a> GroupOpsBounds<'a, Element, ElementVar> for ElementVar
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
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
Mutably borrows from an owned value. Read more
Source§impl<T> CanonicalSerializeHashExt for Twhere
T: CanonicalSerialize,
impl<T> CanonicalSerializeHashExt for Twhere
T: CanonicalSerialize,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
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
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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