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) -> Elementwhere
I: IntoIterator,
I::Item: Borrow<Fr>,
J: IntoIterator,
J::Item: Borrow<Element>,
pub fn vartime_multiscalar_mul<I, J>(scalars: I, points: J) -> Elementwhere I: IntoIterator, I::Item: Borrow<Fr>, J: IntoIterator, J::Item: Borrow<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.
pub fn map_to_group_uniform(r_1: &Fq, r_2: &Fq) -> Element
👎Deprecated: please use
hash_to_curve insteadsourcepub 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.
pub fn map_to_group_cdh(r: &Fq) -> Element
👎Deprecated: please use
encode_to_curve insteadsource§impl Element
impl Element
pub fn compress_to_field(&self) -> Fq
👎Deprecated: please use
vartime_compress_to_field insteadpub fn vartime_compress_to_field(&self) -> Fq
pub fn compress(&self) -> Encoding
👎Deprecated: please use
vartime_compress insteadpub fn vartime_compress(&self) -> Encoding
Trait Implementations§
source§impl<'a> Add<&'a AffineElement> for Element
impl<'a> Add<&'a AffineElement> for Element
source§impl<'a> Add<&'a Element> for AffineElement
impl<'a> Add<&'a Element> for AffineElement
source§impl Add<AffineElement> for Element
impl Add<AffineElement> for Element
source§impl Add<Element> for AffineElement
impl Add<Element> for AffineElement
source§impl<'a> AddAssign<&'a AffineElement> for Element
impl<'a> AddAssign<&'a AffineElement> for Element
source§fn add_assign(&mut self, other: &'a AffineElement)
fn add_assign(&mut self, other: &'a AffineElement)
Performs the
+= operation. Read moresource§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<AffineElement> for Element
impl AddAssign<AffineElement> for Element
source§fn add_assign(&mut self, other: AffineElement)
fn add_assign(&mut self, other: AffineElement)
Performs the
+= operation. Read moresource§impl AddAssign<Element> for Element
impl AddAssign<Element> 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 = EdwardsConfig
§type BaseField = Fp<MontBackend<FrConfig, 4>, 4>
type BaseField = Fp<MontBackend<FrConfig, 4>, 4>
The field over which this curve is defined.
§type Affine = AffineElement
type Affine = AffineElement
The affine representation of this element.
§type FullGroup = AffineElement
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>
fn normalize_batch(v: &[Self]) -> Vec<AffineElement>
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§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Element
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Element
Generate a random value of
T, using rng as the source of randomness.source§impl From<&AffineElement> for Element
impl From<&AffineElement> for Element
source§fn from(point: &AffineElement) -> Self
fn from(point: &AffineElement) -> Self
Converts to this type from the input type.
source§impl From<&Element> for AffineElement
impl From<&Element> for AffineElement
source§impl From<AffineElement> for Element
impl From<AffineElement> for Element
source§fn from(point: AffineElement) -> Self
fn from(point: AffineElement) -> Self
Converts to this type from the input type.
source§impl From<Element> for AffineElement
impl From<Element> for AffineElement
source§impl Group for Element
impl Group for Element
§type ScalarField = Fp<MontBackend<FrConfig, 4>, 4>
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
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 Fp<MontBackend<FrConfig, 4>, 4>> for Element
impl<'b> MulAssign<&'b Fp<MontBackend<FrConfig, 4>, 4>> 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<Fp<MontBackend<FrConfig, 4>, 4>> for Element
impl MulAssign<Fp<MontBackend<FrConfig, 4>, 4>> for Element
source§fn mul_assign(&mut self, other: Fr)
fn mul_assign(&mut self, other: Fr)
Performs the
*= operation. Read moresource§impl PartialEq<Element> for Element
impl PartialEq<Element> for Element
source§impl ScalarMul for Element
impl ScalarMul for Element
type MulBase = AffineElement
const NEGATION_IS_CHEAP: bool = true
fn batch_convert_to_mul_base(bases: &[Self]) -> Vec<Self::MulBase>
source§impl<'a> Sub<&'a AffineElement> for Element
impl<'a> Sub<&'a AffineElement> for Element
source§impl Sub<AffineElement> for Element
impl Sub<AffineElement> for Element
source§impl<'a> SubAssign<&'a AffineElement> for Element
impl<'a> SubAssign<&'a AffineElement> for Element
source§fn sub_assign(&mut self, other: &'a AffineElement)
fn sub_assign(&mut self, other: &'a AffineElement)
Performs the
-= operation. Read moresource§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<AffineElement> for Element
impl SubAssign<AffineElement> for Element
source§fn sub_assign(&mut self, other: AffineElement)
fn sub_assign(&mut self, other: AffineElement)
Performs the
-= operation. Read moresource§impl SubAssign<Element> for Element
impl SubAssign<Element> for Element
source§fn sub_assign(&mut self, other: Element)
fn sub_assign(&mut self, other: Element)
Performs the
-= operation. Read moresource§impl<'a> Sum<&'a AffineElement> for Element
impl<'a> Sum<&'a AffineElement> for Element
source§fn sum<I: Iterator<Item = &'a AffineElement>>(iter: I) -> Self
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 Sum<AffineElement> for Element
impl Sum<AffineElement> for Element
source§fn sum<I: Iterator<Item = AffineElement>>(iter: I) -> Self
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 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
source§impl<T> CanonicalSerializeHashExt for Twhere
T: CanonicalSerialize,
impl<T> CanonicalSerializeHashExt for Twhere T: CanonicalSerialize,
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more