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
impl ProjectivePoint
sourcepub const fn identity() -> ProjectivePoint
👎Deprecated since 0.10.2: use ProjectivePoint::IDENTITY
instead
pub const fn identity() -> ProjectivePoint
ProjectivePoint::IDENTITY
insteadReturns the additive identity of SECP256k1, also known as the “neutral element” or “point at infinity”.
sourcepub fn generator() -> ProjectivePoint
👎Deprecated since 0.10.2: use ProjectivePoint::GENERATOR
instead
pub fn generator() -> ProjectivePoint
ProjectivePoint::GENERATOR
insteadReturns the base point of SECP256k1.
sourcepub fn to_affine(&self) -> AffinePoint
pub fn to_affine(&self) -> AffinePoint
Returns the affine representation of this point, or None
if it is the identity.
sourcepub fn double(&self) -> ProjectivePoint
pub fn double(&self) -> ProjectivePoint
Doubles this point.
sourcepub fn endomorphism(&self) -> Self
pub fn endomorphism(&self) -> Self
Calculates SECP256k1 endomorphism: self * lambda
.
sourcepub fn eq_affine(&self, other: &AffinePoint) -> Choice
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
impl Add<&AffinePoint> for &ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
+
operator.source§fn add(self, other: &AffinePoint) -> ProjectivePoint
fn add(self, other: &AffinePoint) -> ProjectivePoint
Performs the
+
operation. Read moresource§impl Add<&AffinePoint> for ProjectivePoint
impl Add<&AffinePoint> for ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
+
operator.source§fn add(self, other: &AffinePoint) -> ProjectivePoint
fn add(self, other: &AffinePoint) -> ProjectivePoint
Performs the
+
operation. Read moresource§impl Add<&ProjectivePoint> for &ProjectivePoint
impl Add<&ProjectivePoint> for &ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
+
operator.source§fn add(self, other: &ProjectivePoint) -> ProjectivePoint
fn add(self, other: &ProjectivePoint) -> ProjectivePoint
Performs the
+
operation. Read moresource§impl Add<&ProjectivePoint> for ProjectivePoint
impl Add<&ProjectivePoint> for ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
+
operator.source§fn add(self, other: &ProjectivePoint) -> ProjectivePoint
fn add(self, other: &ProjectivePoint) -> ProjectivePoint
Performs the
+
operation. Read moresource§impl Add<AffinePoint> for ProjectivePoint
impl Add<AffinePoint> for ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
+
operator.source§fn add(self, other: AffinePoint) -> ProjectivePoint
fn add(self, other: AffinePoint) -> ProjectivePoint
Performs the
+
operation. Read moresource§impl Add<ProjectivePoint> for ProjectivePoint
impl Add<ProjectivePoint> for ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
+
operator.source§fn add(self, other: ProjectivePoint) -> ProjectivePoint
fn add(self, other: ProjectivePoint) -> ProjectivePoint
Performs the
+
operation. Read moresource§impl AddAssign<&AffinePoint> for ProjectivePoint
impl AddAssign<&AffinePoint> for ProjectivePoint
source§fn add_assign(&mut self, rhs: &AffinePoint)
fn add_assign(&mut self, rhs: &AffinePoint)
Performs the
+=
operation. Read moresource§impl AddAssign<&ProjectivePoint> for ProjectivePoint
impl AddAssign<&ProjectivePoint> for ProjectivePoint
source§fn add_assign(&mut self, rhs: &ProjectivePoint)
fn add_assign(&mut self, rhs: &ProjectivePoint)
Performs the
+=
operation. Read moresource§impl AddAssign<AffinePoint> for ProjectivePoint
impl AddAssign<AffinePoint> for ProjectivePoint
source§fn add_assign(&mut self, rhs: AffinePoint)
fn add_assign(&mut self, rhs: AffinePoint)
Performs the
+=
operation. Read moresource§impl AddAssign<ProjectivePoint> for ProjectivePoint
impl AddAssign<ProjectivePoint> for ProjectivePoint
source§fn add_assign(&mut self, rhs: ProjectivePoint)
fn add_assign(&mut self, rhs: ProjectivePoint)
Performs the
+=
operation. Read moresource§impl Clone for ProjectivePoint
impl Clone for ProjectivePoint
source§fn clone(&self) -> ProjectivePoint
fn clone(&self) -> ProjectivePoint
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl ConditionallySelectable for ProjectivePoint
impl ConditionallySelectable for ProjectivePoint
source§impl ConstantTimeEq for ProjectivePoint
impl ConstantTimeEq for ProjectivePoint
source§impl Curve for ProjectivePoint
impl Curve for ProjectivePoint
§type AffineRepr = AffinePoint
type AffineRepr = AffinePoint
The affine representation for this elliptic curve.
source§fn to_affine(&self) -> AffinePoint
fn to_affine(&self) -> AffinePoint
Converts this element into its affine representation.
§fn batch_normalize(p: &[Self], q: &mut [Self::AffineRepr])
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()
.source§impl Debug for ProjectivePoint
impl Debug for ProjectivePoint
source§impl Default for ProjectivePoint
impl Default for ProjectivePoint
source§impl From<&AffinePoint> for ProjectivePoint
impl From<&AffinePoint> for ProjectivePoint
source§fn from(p: &AffinePoint) -> Self
fn from(p: &AffinePoint) -> Self
Converts to this type from the input type.
source§impl From<&ProjectivePoint> for AffinePoint
impl From<&ProjectivePoint> for AffinePoint
source§fn from(p: &ProjectivePoint) -> AffinePoint
fn from(p: &ProjectivePoint) -> AffinePoint
Converts to this type from the input type.
source§impl From<&PublicKey<Secp256k1>> for ProjectivePoint
impl From<&PublicKey<Secp256k1>> for ProjectivePoint
source§fn from(public_key: &PublicKey) -> ProjectivePoint
fn from(public_key: &PublicKey) -> ProjectivePoint
Converts to this type from the input type.
source§impl From<AffinePoint> for ProjectivePoint
impl From<AffinePoint> for ProjectivePoint
source§fn from(p: AffinePoint) -> Self
fn from(p: AffinePoint) -> Self
Converts to this type from the input type.
source§impl From<ProjectivePoint> for AffinePoint
impl From<ProjectivePoint> for AffinePoint
source§fn from(p: ProjectivePoint) -> AffinePoint
fn from(p: ProjectivePoint) -> AffinePoint
Converts to this type from the input type.
source§impl From<PublicKey<Secp256k1>> for ProjectivePoint
impl From<PublicKey<Secp256k1>> for ProjectivePoint
source§fn from(public_key: PublicKey) -> ProjectivePoint
fn from(public_key: PublicKey) -> ProjectivePoint
Converts to this type from the input type.
source§impl FromEncodedPoint<Secp256k1> for ProjectivePoint
impl FromEncodedPoint<Secp256k1> for ProjectivePoint
source§fn from_encoded_point(p: &EncodedPoint) -> CtOption<Self>
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
impl Group for ProjectivePoint
source§impl GroupEncoding for ProjectivePoint
impl GroupEncoding for ProjectivePoint
§type Repr = GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B1>>
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>
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>
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§impl LinearCombination for ProjectivePoint
impl LinearCombination for ProjectivePoint
source§fn lincomb(
x: &ProjectivePoint,
k: &Scalar,
y: &ProjectivePoint,
l: &Scalar
) -> ProjectivePoint
fn lincomb( x: &ProjectivePoint, k: &Scalar, y: &ProjectivePoint, l: &Scalar ) -> ProjectivePoint
Calculates
x * k + y * l
.source§impl Mul<&Scalar> for &ProjectivePoint
impl Mul<&Scalar> for &ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
*
operator.source§impl Mul<&Scalar> for ProjectivePoint
impl Mul<&Scalar> for ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
*
operator.source§impl Mul<Scalar> for ProjectivePoint
impl Mul<Scalar> for ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
*
operator.source§impl MulAssign<&Scalar> for ProjectivePoint
impl MulAssign<&Scalar> for ProjectivePoint
source§fn mul_assign(&mut self, rhs: &Scalar)
fn mul_assign(&mut self, rhs: &Scalar)
Performs the
*=
operation. Read moresource§impl MulAssign<Scalar> for ProjectivePoint
impl MulAssign<Scalar> for ProjectivePoint
source§fn mul_assign(&mut self, rhs: Scalar)
fn mul_assign(&mut self, rhs: Scalar)
Performs the
*=
operation. Read moresource§impl MulByGenerator for ProjectivePoint
impl MulByGenerator for ProjectivePoint
source§fn mul_by_generator(k: &Scalar) -> ProjectivePoint
fn mul_by_generator(k: &Scalar) -> ProjectivePoint
Calculates k * G
, where G
is the generator.
source§impl<'a> Neg for &'a ProjectivePoint
impl<'a> Neg for &'a ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
-
operator.source§fn neg(self) -> ProjectivePoint
fn neg(self) -> ProjectivePoint
Performs the unary
-
operation. Read moresource§impl Neg for ProjectivePoint
impl Neg for ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
-
operator.source§fn neg(self) -> ProjectivePoint
fn neg(self) -> ProjectivePoint
Performs the unary
-
operation. Read moresource§impl PartialEq<AffinePoint> for ProjectivePoint
impl PartialEq<AffinePoint> for ProjectivePoint
source§fn eq(&self, other: &AffinePoint) -> bool
fn eq(&self, other: &AffinePoint) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<ProjectivePoint> for AffinePoint
impl PartialEq<ProjectivePoint> for AffinePoint
source§fn eq(&self, other: &ProjectivePoint) -> bool
fn eq(&self, other: &ProjectivePoint) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<ProjectivePoint> for ProjectivePoint
impl PartialEq<ProjectivePoint> for ProjectivePoint
source§impl PrimeCurve for ProjectivePoint
impl PrimeCurve for ProjectivePoint
type Affine = AffinePoint
source§impl Sub<&AffinePoint> for &ProjectivePoint
impl Sub<&AffinePoint> for &ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
-
operator.source§fn sub(self, other: &AffinePoint) -> ProjectivePoint
fn sub(self, other: &AffinePoint) -> ProjectivePoint
Performs the
-
operation. Read moresource§impl Sub<&AffinePoint> for ProjectivePoint
impl Sub<&AffinePoint> for ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
-
operator.source§fn sub(self, other: &AffinePoint) -> ProjectivePoint
fn sub(self, other: &AffinePoint) -> ProjectivePoint
Performs the
-
operation. Read moresource§impl Sub<&ProjectivePoint> for &ProjectivePoint
impl Sub<&ProjectivePoint> for &ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
-
operator.source§fn sub(self, other: &ProjectivePoint) -> ProjectivePoint
fn sub(self, other: &ProjectivePoint) -> ProjectivePoint
Performs the
-
operation. Read moresource§impl Sub<&ProjectivePoint> for ProjectivePoint
impl Sub<&ProjectivePoint> for ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
-
operator.source§fn sub(self, other: &ProjectivePoint) -> ProjectivePoint
fn sub(self, other: &ProjectivePoint) -> ProjectivePoint
Performs the
-
operation. Read moresource§impl Sub<AffinePoint> for ProjectivePoint
impl Sub<AffinePoint> for ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
-
operator.source§fn sub(self, other: AffinePoint) -> ProjectivePoint
fn sub(self, other: AffinePoint) -> ProjectivePoint
Performs the
-
operation. Read moresource§impl Sub<ProjectivePoint> for ProjectivePoint
impl Sub<ProjectivePoint> for ProjectivePoint
§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
-
operator.source§fn sub(self, other: ProjectivePoint) -> ProjectivePoint
fn sub(self, other: ProjectivePoint) -> ProjectivePoint
Performs the
-
operation. Read moresource§impl SubAssign<&AffinePoint> for ProjectivePoint
impl SubAssign<&AffinePoint> for ProjectivePoint
source§fn sub_assign(&mut self, rhs: &AffinePoint)
fn sub_assign(&mut self, rhs: &AffinePoint)
Performs the
-=
operation. Read moresource§impl SubAssign<&ProjectivePoint> for ProjectivePoint
impl SubAssign<&ProjectivePoint> for ProjectivePoint
source§fn sub_assign(&mut self, rhs: &ProjectivePoint)
fn sub_assign(&mut self, rhs: &ProjectivePoint)
Performs the
-=
operation. Read moresource§impl SubAssign<AffinePoint> for ProjectivePoint
impl SubAssign<AffinePoint> for ProjectivePoint
source§fn sub_assign(&mut self, rhs: AffinePoint)
fn sub_assign(&mut self, rhs: AffinePoint)
Performs the
-=
operation. Read moresource§impl SubAssign<ProjectivePoint> for ProjectivePoint
impl SubAssign<ProjectivePoint> for ProjectivePoint
source§fn sub_assign(&mut self, rhs: ProjectivePoint)
fn sub_assign(&mut self, rhs: ProjectivePoint)
Performs the
-=
operation. Read moresource§impl<'a> Sum<&'a ProjectivePoint> for ProjectivePoint
impl<'a> Sum<&'a ProjectivePoint> for ProjectivePoint
source§fn sum<I: Iterator<Item = &'a ProjectivePoint>>(iter: I) -> Self
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<ProjectivePoint> for ProjectivePoint
impl Sum<ProjectivePoint> for ProjectivePoint
source§impl ToEncodedPoint<Secp256k1> for ProjectivePoint
impl ToEncodedPoint<Secp256k1> for ProjectivePoint
source§fn to_encoded_point(&self, compress: bool) -> EncodedPoint
fn to_encoded_point(&self, compress: bool) -> EncodedPoint
Serialize this value as a SEC1
EncodedPoint
, optionally applying
point compression.