Skip to main content

ProjectivePoint

Struct ProjectivePoint 

pub struct ProjectivePoint { /* private fields */ }
Expand description

A point on the secp256k1 curve in projective coordinates.

Implementations§

§

impl ProjectivePoint

pub const IDENTITY: ProjectivePoint

Additive identity of the group: the point at infinity.

pub const GENERATOR: ProjectivePoint

Base point of secp256k1.

pub const fn identity() -> ProjectivePoint

👎Deprecated since 0.10.2: use ProjectivePoint::IDENTITY instead

Returns the additive identity of SECP256k1, also known as the “neutral element” or “point at infinity”.

pub fn generator() -> ProjectivePoint

👎Deprecated since 0.10.2: use ProjectivePoint::GENERATOR instead

Returns the base point of SECP256k1.

pub fn to_affine(&self) -> AffinePoint

Returns the affine representation of this point.

pub fn double(&self) -> ProjectivePoint

Doubles this point.

pub fn endomorphism(&self) -> ProjectivePoint

Calculates SECP256k1 endomorphism: self * lambda.

pub fn eq_affine(&self, other: &AffinePoint) -> Choice

Check whether self is equal to an affine point.

This is a lot faster than first converting self to an AffinePoint and then doing the comparison. It is a little bit faster than converting other to a ProjectivePoint first.

Trait Implementations§

§

impl Add<&AffinePoint> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
§

fn add(self, other: &AffinePoint) -> ProjectivePoint

Performs the + operation. Read more
§

impl Add<&AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
§

fn add(self, other: &AffinePoint) -> ProjectivePoint

Performs the + operation. Read more
§

impl Add<&ProjectivePoint> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
§

fn add(self, other: &ProjectivePoint) -> ProjectivePoint

Performs the + operation. Read more
§

impl Add<&ProjectivePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
§

fn add(self, other: &ProjectivePoint) -> ProjectivePoint

Performs the + operation. Read more
§

impl Add<AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
§

fn add(self, other: AffinePoint) -> ProjectivePoint

Performs the + operation. Read more
§

impl Add for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
§

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

Performs the + operation. Read more
§

impl AddAssign<&AffinePoint> for ProjectivePoint

§

fn add_assign(&mut self, rhs: &AffinePoint)

Performs the += operation. Read more
§

impl AddAssign<&ProjectivePoint> for ProjectivePoint

§

fn add_assign(&mut self, rhs: &ProjectivePoint)

Performs the += operation. Read more
§

impl AddAssign<AffinePoint> for ProjectivePoint

§

fn add_assign(&mut self, rhs: AffinePoint)

Performs the += operation. Read more
§

impl AddAssign for ProjectivePoint

§

fn add_assign(&mut self, rhs: ProjectivePoint)

Performs the += operation. Read more
§

impl<const N: usize> BatchNormalize<[ProjectivePoint; N]> for ProjectivePoint

§

type Output = [<ProjectivePoint as Curve>::AffineRepr; N]

The output of the batch normalization; a container of affine points.
§

fn batch_normalize( points: &[ProjectivePoint; N], ) -> [<ProjectivePoint as Curve>::AffineRepr; N]

Perform a batched conversion to affine representation on a sequence of projective points at an amortized cost that should be practically as efficient as a single conversion. Internally, implementors should rely upon InvertBatch.
§

impl Clone for ProjectivePoint

§

fn clone(&self) -> ProjectivePoint

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl ConditionallySelectable for ProjectivePoint

§

fn conditional_select( a: &ProjectivePoint, b: &ProjectivePoint, choice: Choice, ) -> ProjectivePoint

Select a or b according to choice. Read more
Source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
Source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
§

impl ConstantTimeEq for ProjectivePoint

§

fn ct_eq(&self, other: &ProjectivePoint) -> Choice

Determine if two items are equal. Read more
Source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
§

impl Curve for ProjectivePoint

§

type AffineRepr = AffinePoint

The affine representation for this elliptic curve.
§

fn to_affine(&self) -> AffinePoint

Converts this element into its affine representation.
§

fn batch_normalize(p: &[Self], q: &mut [Self::AffineRepr])

Converts a batch of projective elements into affine elements. This function will panic if p.len() != q.len().
§

impl Debug for ProjectivePoint

§

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

Formats the value using the given formatter. Read more
§

impl Default for ProjectivePoint

§

fn default() -> ProjectivePoint

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

impl From<&AffinePoint> for ProjectivePoint

§

fn from(p: &AffinePoint) -> ProjectivePoint

Converts to this type from the input type.
§

impl From<&ProjectivePoint> for AffinePoint

§

fn from(p: &ProjectivePoint) -> AffinePoint

Converts to this type from the input type.
§

impl From<&PublicKey<Secp256k1>> for ProjectivePoint

§

fn from(public_key: &PublicKey<Secp256k1>) -> ProjectivePoint

Converts to this type from the input type.
§

impl From<AffinePoint> for ProjectivePoint

§

fn from(p: AffinePoint) -> ProjectivePoint

Converts to this type from the input type.
§

impl From<ProjectivePoint> for AffinePoint

§

fn from(p: ProjectivePoint) -> AffinePoint

Converts to this type from the input type.
§

impl From<PublicKey<Secp256k1>> for ProjectivePoint

§

fn from(public_key: PublicKey<Secp256k1>) -> ProjectivePoint

Converts to this type from the input type.
§

impl FromEncodedPoint<Secp256k1> for ProjectivePoint

§

fn from_encoded_point( p: &EncodedPoint<<Secp256k1 as Curve>::FieldBytesSize>, ) -> CtOption<ProjectivePoint>

Deserialize the type this trait is impl’d on from an EncodedPoint.
§

impl Group for ProjectivePoint

§

type Scalar = Scalar

Scalars modulo the order of this group’s scalar field.
§

fn random(rng: impl RngCore) -> ProjectivePoint

Returns an element chosen uniformly at random from the non-identity elements of this group. Read more
§

fn identity() -> ProjectivePoint

Returns the additive identity, also known as the “neutral element”.
§

fn generator() -> ProjectivePoint

Returns a fixed generator of the prime-order subgroup.
§

fn is_identity(&self) -> Choice

Determines if this point is the identity.
§

fn double(&self) -> ProjectivePoint

Doubles this element.
§

impl GroupEncoding for ProjectivePoint

§

type Repr = GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B1>>

The encoding of group elements. Read more
§

fn from_bytes( bytes: &<ProjectivePoint as GroupEncoding>::Repr, ) -> CtOption<ProjectivePoint>

Attempts to deserialize a group element from its encoding.
§

fn from_bytes_unchecked( bytes: &<ProjectivePoint as GroupEncoding>::Repr, ) -> CtOption<ProjectivePoint>

Attempts to deserialize a group element, not checking if the element is valid. Read more
§

fn to_bytes(&self) -> <ProjectivePoint as GroupEncoding>::Repr

Converts this element into its byte encoding. This may or may not support encoding the identity.
§

impl<const N: usize> LinearCombinationExt<[(ProjectivePoint, Scalar); N]> for ProjectivePoint

§

fn lincomb_ext( points_and_scalars: &[(ProjectivePoint, Scalar); N], ) -> ProjectivePoint

Calculates x1 * k1 + ... + xn * kn.
§

impl Mul<&Scalar> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the * operator.
§

fn mul(self, other: &Scalar) -> ProjectivePoint

Performs the * operation. Read more
§

impl Mul<&Scalar> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the * operator.
§

fn mul(self, other: &Scalar) -> ProjectivePoint

Performs the * operation. Read more
§

impl Mul<Scalar> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the * operator.
§

fn mul(self, other: Scalar) -> ProjectivePoint

Performs the * operation. Read more
§

impl MulAssign<&Scalar> for ProjectivePoint

§

fn mul_assign(&mut self, rhs: &Scalar)

Performs the *= operation. Read more
§

impl MulAssign<Scalar> for ProjectivePoint

§

fn mul_assign(&mut self, rhs: Scalar)

Performs the *= operation. Read more
§

impl MulByGenerator for ProjectivePoint

§

fn mul_by_generator(k: &Scalar) -> ProjectivePoint

Calculates k * G, where G is the generator.

§

impl<'a> Neg for &'a ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
§

fn neg(self) -> ProjectivePoint

Performs the unary - operation. Read more
§

impl Neg for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
§

fn neg(self) -> ProjectivePoint

Performs the unary - operation. Read more
§

impl PartialEq<AffinePoint> for ProjectivePoint

§

fn eq(&self, other: &AffinePoint) -> 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.
§

impl PartialEq<ProjectivePoint> for AffinePoint

§

fn eq(&self, other: &ProjectivePoint) -> 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.
§

impl PartialEq for ProjectivePoint

§

fn eq(&self, other: &ProjectivePoint) -> 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.
§

impl PrimeCurve for ProjectivePoint

§

impl Sub<&AffinePoint> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
§

fn sub(self, other: &AffinePoint) -> ProjectivePoint

Performs the - operation. Read more
§

impl Sub<&AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
§

fn sub(self, other: &AffinePoint) -> ProjectivePoint

Performs the - operation. Read more
§

impl Sub<&ProjectivePoint> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
§

fn sub(self, other: &ProjectivePoint) -> ProjectivePoint

Performs the - operation. Read more
§

impl Sub<&ProjectivePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
§

fn sub(self, other: &ProjectivePoint) -> ProjectivePoint

Performs the - operation. Read more
§

impl Sub<AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
§

fn sub(self, other: AffinePoint) -> ProjectivePoint

Performs the - operation. Read more
§

impl Sub for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
§

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

Performs the - operation. Read more
§

impl SubAssign<&AffinePoint> for ProjectivePoint

§

fn sub_assign(&mut self, rhs: &AffinePoint)

Performs the -= operation. Read more
§

impl SubAssign<&ProjectivePoint> for ProjectivePoint

§

fn sub_assign(&mut self, rhs: &ProjectivePoint)

Performs the -= operation. Read more
§

impl SubAssign<AffinePoint> for ProjectivePoint

§

fn sub_assign(&mut self, rhs: AffinePoint)

Performs the -= operation. Read more
§

impl SubAssign for ProjectivePoint

§

fn sub_assign(&mut self, rhs: ProjectivePoint)

Performs the -= operation. Read more
§

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

§

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

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

impl Sum for ProjectivePoint

§

fn sum<I>(iter: I) -> ProjectivePoint
where I: Iterator<Item = ProjectivePoint>,

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

impl ToEncodedPoint<Secp256k1> for ProjectivePoint

§

fn to_encoded_point( &self, compress: bool, ) -> EncodedPoint<<Secp256k1 as Curve>::FieldBytesSize>

Serialize this value as a SEC1 EncodedPoint, optionally applying point compression.
§

impl TryFrom<&ProjectivePoint> for PublicKey<Secp256k1>

§

type Error = Error

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

fn try_from(point: &ProjectivePoint) -> Result<PublicKey<Secp256k1>, Error>

Performs the conversion.
§

impl TryFrom<ProjectivePoint> for PublicKey<Secp256k1>

§

type Error = Error

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

fn try_from(point: ProjectivePoint) -> Result<PublicKey<Secp256k1>, Error>

Performs the conversion.
§

impl Copy for ProjectivePoint

§

impl DefaultIsZeroes for ProjectivePoint

§

impl Eq for ProjectivePoint

§

impl PrimeGroup for ProjectivePoint

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> CloneToUninit for T
where T: Clone,

Source§

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

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

impl<T> ConditionallyNegatable for T
where T: ConditionallySelectable, &'a T: for<'a> Neg<Output = T>,

Source§

fn conditional_negate(&mut self, choice: Choice)

Negate self if choice == Choice(1); otherwise, leave it unchanged. 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.

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<P> LinearCombination for P
where P: LinearCombinationExt<[(P, <P as Group>::Scalar); 2]>,

§

fn lincomb( x: &P, k: &<P as Group>::Scalar, y: &P, l: &<P as Group>::Scalar, ) -> P

Calculates x * k + y * l.
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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<Z> Zeroize for Z
where Z: DefaultIsZeroes,

§

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

impl<T, Rhs, Output> GroupOps<Rhs, Output> for T
where T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>,

§

impl<T, Rhs, Output> GroupOpsOwned<Rhs, Output> for T
where T: for<'r> GroupOps<&'r Rhs, Output>,

§

impl<T, Rhs, Output> ScalarMul<Rhs, Output> for T
where T: Mul<Rhs, Output = Output> + MulAssign<Rhs>,

§

impl<T, Rhs, Output> ScalarMulOwned<Rhs, Output> for T
where T: for<'r> ScalarMul<&'r Rhs, Output>,