Struct k256::ProjectivePoint

source ·
pub struct ProjectivePoint { /* private fields */ }
Available on crate feature arithmetic only.
Expand description

A point on the secp256k1 curve in projective coordinates.

Implementations§

source§

impl ProjectivePoint

source

pub const IDENTITY: Self = _

Additive identity of the group: the point at infinity.

source

pub const GENERATOR: Self = _

Base point of secp256k1.

source

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

source

pub fn generator() -> ProjectivePoint

👎Deprecated since 0.10.2: use ProjectivePoint::GENERATOR instead

Returns the base point of SECP256k1.

source

pub fn to_affine(&self) -> AffinePoint

Returns the affine representation of this point.

source

pub fn double(&self) -> ProjectivePoint

Doubles this point.

source

pub fn endomorphism(&self) -> Self

Calculates SECP256k1 endomorphism: self * lambda.

source

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§

source§

impl Add<&AffinePoint> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&ProjectivePoint> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&ProjectivePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl AddAssign<&AffinePoint> for ProjectivePoint

source§

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

Performs the += operation. Read more
source§

impl AddAssign<&ProjectivePoint> for ProjectivePoint

source§

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

Performs the += operation. Read more
source§

impl AddAssign<AffinePoint> for ProjectivePoint

source§

fn add_assign(&mut self, rhs: AffinePoint)

Performs the += operation. Read more
source§

impl AddAssign for ProjectivePoint

source§

fn add_assign(&mut self, rhs: ProjectivePoint)

Performs the += operation. Read more
source§

impl BatchNormalize<[ProjectivePoint]> for ProjectivePoint

Available on crate feature alloc only.
§

type Output = Vec<<ProjectivePoint as Curve>::AffineRepr>

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

fn batch_normalize(points: &[Self]) -> Vec<Self::AffineRepr>

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

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

fn batch_normalize(points: &[Self; N]) -> [Self::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.
source§

impl Clone for ProjectivePoint

source§

fn clone(&self) -> ProjectivePoint

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 ConditionallySelectable for ProjectivePoint

source§

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

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

impl ConstantTimeEq for ProjectivePoint

source§

fn ct_eq(&self, other: &Self) -> 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
source§

impl Curve for ProjectivePoint

§

type AffineRepr = AffinePoint

The affine representation for this elliptic curve.
source§

fn to_affine(&self) -> AffinePoint

Converts this element into its affine representation.
source§

fn batch_normalize(projective: &[Self], affine: &mut [Self::AffineRepr])

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

impl Debug for ProjectivePoint

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for ProjectivePoint

source§

fn default() -> Self

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

impl From<&AffinePoint> for ProjectivePoint

source§

fn from(p: &AffinePoint) -> Self

Converts to this type from the input type.
source§

impl From<&ProjectivePoint> for AffinePoint

source§

fn from(p: &ProjectivePoint) -> AffinePoint

Converts to this type from the input type.
source§

impl From<&PublicKey<Secp256k1>> for ProjectivePoint

source§

fn from(public_key: &PublicKey) -> ProjectivePoint

Converts to this type from the input type.
source§

impl From<AffinePoint> for ProjectivePoint

source§

fn from(p: AffinePoint) -> Self

Converts to this type from the input type.
source§

impl From<ProjectivePoint> for AffinePoint

source§

fn from(p: ProjectivePoint) -> AffinePoint

Converts to this type from the input type.
source§

impl From<PublicKey<Secp256k1>> for ProjectivePoint

source§

fn from(public_key: PublicKey) -> ProjectivePoint

Converts to this type from the input type.
source§

impl FromEncodedPoint<Secp256k1> for ProjectivePoint

source§

fn from_encoded_point(p: &EncodedPoint) -> CtOption<Self>

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

impl Group for ProjectivePoint

§

type Scalar = Scalar

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

fn random(rng: impl RngCore) -> Self

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

fn identity() -> Self

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

fn generator() -> Self

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

fn is_identity(&self) -> Choice

Determines if this point is the identity.
source§

fn double(&self) -> Self

Doubles this element.
source§

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

fn from_bytes(bytes: &Self::Repr) -> CtOption<Self>

Attempts to deserialize a group element from its encoding.
source§

fn from_bytes_unchecked(bytes: &Self::Repr) -> CtOption<Self>

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

fn to_bytes(&self) -> Self::Repr

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

impl LinearCombinationExt<[(ProjectivePoint, Scalar)]> for ProjectivePoint

Available on crate feature alloc only.
source§

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

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

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

source§

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

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

impl Mul<&Scalar> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<&Scalar> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<Scalar> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl MulAssign<&Scalar> for ProjectivePoint

source§

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

Performs the *= operation. Read more
source§

impl MulAssign<Scalar> for ProjectivePoint

source§

fn mul_assign(&mut self, rhs: Scalar)

Performs the *= operation. Read more
source§

impl MulByGenerator for ProjectivePoint

source§

fn mul_by_generator(k: &Scalar) -> ProjectivePoint

Calculates k * G, where G is the generator.

source§

impl<'a> Neg for &'a ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
source§

fn neg(self) -> ProjectivePoint

Performs the unary - operation. Read more
source§

impl Neg for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
source§

fn neg(self) -> ProjectivePoint

Performs the unary - operation. Read more
source§

impl PartialEq<AffinePoint> for ProjectivePoint

source§

fn eq(&self, other: &AffinePoint) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ProjectivePoint> for AffinePoint

source§

fn eq(&self, other: &ProjectivePoint) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for ProjectivePoint

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PrimeCurve for ProjectivePoint

source§

impl Sub<&AffinePoint> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub<&AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub<&ProjectivePoint> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub<&ProjectivePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub<AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl SubAssign<&AffinePoint> for ProjectivePoint

source§

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

Performs the -= operation. Read more
source§

impl SubAssign<&ProjectivePoint> for ProjectivePoint

source§

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

Performs the -= operation. Read more
source§

impl SubAssign<AffinePoint> for ProjectivePoint

source§

fn sub_assign(&mut self, rhs: AffinePoint)

Performs the -= operation. Read more
source§

impl SubAssign for ProjectivePoint

source§

fn sub_assign(&mut self, rhs: ProjectivePoint)

Performs the -= operation. Read more
source§

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

source§

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

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl Sum for ProjectivePoint

source§

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

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl ToEncodedPoint<Secp256k1> for ProjectivePoint

source§

fn to_encoded_point(&self, compress: bool) -> EncodedPoint

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

impl TryFrom<&ProjectivePoint> for PublicKey

§

type Error = Error

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

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

Performs the conversion.
source§

impl TryFrom<ProjectivePoint> for PublicKey

§

type Error = Error

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

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

Performs the conversion.
source§

impl Copy for ProjectivePoint

source§

impl DefaultIsZeroes for ProjectivePoint

source§

impl Eq for ProjectivePoint

source§

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

source§

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

§

type Output = T

Should always be Self
source§

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

§

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

§

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

§

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