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
ExactSizeIterators 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<'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 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
§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
§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.
source§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 PartialEq for Element
impl PartialEq for Element
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 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
source§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 moresource§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 moresource§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
Auto Trait Implementations§
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