pub struct ProjectivePoint { /* private fields */ }
Expand description
A point on the secp256k1 curve in projective coordinates.
Implementations§
Source§impl ProjectivePoint
impl ProjectivePoint
Sourcepub const IDENTITY: ProjectivePoint
pub const IDENTITY: ProjectivePoint
Additive identity of the group: the point at infinity.
Sourcepub const GENERATOR: ProjectivePoint
pub const GENERATOR: ProjectivePoint
Base point of secp256k1.
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.
Sourcepub fn double(&self) -> ProjectivePoint
pub fn double(&self) -> ProjectivePoint
Doubles this point.
Sourcepub fn endomorphism(&self) -> ProjectivePoint
pub fn endomorphism(&self) -> ProjectivePoint
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
Source§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
Source§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
Source§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
Source§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
Source§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 for ProjectivePoint
impl Add for ProjectivePoint
Source§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 for ProjectivePoint
impl AddAssign for ProjectivePoint
Source§fn add_assign(&mut self, rhs: ProjectivePoint)
fn add_assign(&mut self, rhs: ProjectivePoint)
Performs the
+=
operation. Read moreSource§impl BatchNormalize<[ProjectivePoint]> for ProjectivePoint
impl BatchNormalize<[ProjectivePoint]> for ProjectivePoint
Source§type Output = Vec<<ProjectivePoint as Curve>::AffineRepr>
type Output = Vec<<ProjectivePoint as Curve>::AffineRepr>
The output of the batch normalization; a container of affine points.
Source§fn batch_normalize(
points: &[ProjectivePoint],
) -> Vec<<ProjectivePoint as Curve>::AffineRepr>
fn batch_normalize( points: &[ProjectivePoint], ) -> Vec<<ProjectivePoint as Curve>::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
impl<const N: usize> BatchNormalize<[ProjectivePoint; N]> for ProjectivePoint
Source§type Output = [<ProjectivePoint as Curve>::AffineRepr; N]
type Output = [<ProjectivePoint as Curve>::AffineRepr; N]
The output of the batch normalization; a container of affine points.
Source§fn batch_normalize(
points: &[ProjectivePoint; N],
) -> [<ProjectivePoint as Curve>::AffineRepr; N]
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
.Source§impl Clone for ProjectivePoint
impl Clone for ProjectivePoint
Source§fn clone(&self) -> ProjectivePoint
fn clone(&self) -> ProjectivePoint
Returns a duplicate 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 CofactorGroup for ProjectivePoint
impl CofactorGroup for ProjectivePoint
Source§type Subgroup = ProjectivePoint
type Subgroup = ProjectivePoint
The large prime-order subgroup in which cryptographic operations are performed.
If
Self
implements PrimeGroup
, then Self::Subgroup
may be Self
.Source§fn clear_cofactor(&self) -> <ProjectivePoint as CofactorGroup>::Subgroup
fn clear_cofactor(&self) -> <ProjectivePoint as CofactorGroup>::Subgroup
Maps
self
to the prime-order subgroup by multiplying this element by some
k
-multiple of the cofactor. Read moreSource§fn into_subgroup(self) -> CtOption<<ProjectivePoint as CofactorGroup>::Subgroup>
fn into_subgroup(self) -> CtOption<<ProjectivePoint as CofactorGroup>::Subgroup>
Returns
self
if it is contained in the prime-order subgroup. Read moreSource§fn is_torsion_free(&self) -> Choice
fn is_torsion_free(&self) -> Choice
Determines if this element is “torsion free”, i.e., is contained in the
prime-order subgroup. Read more
Source§fn is_small_order(&self) -> Choice
fn is_small_order(&self) -> Choice
Determines if this element is of small order. Read more
Source§impl ConditionallySelectable for ProjectivePoint
impl ConditionallySelectable for ProjectivePoint
Source§fn conditional_select(
a: &ProjectivePoint,
b: &ProjectivePoint,
choice: Choice,
) -> ProjectivePoint
fn conditional_select( a: &ProjectivePoint, b: &ProjectivePoint, choice: Choice, ) -> ProjectivePoint
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
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 moreSource§impl ConstantTimeEq for ProjectivePoint
impl ConstantTimeEq for ProjectivePoint
Source§impl Curve for ProjectivePoint
impl Curve for ProjectivePoint
Source§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.
Source§fn batch_normalize(
projective: &[ProjectivePoint],
affine: &mut [<ProjectivePoint as Curve>::AffineRepr],
)
fn batch_normalize( projective: &[ProjectivePoint], affine: &mut [<ProjectivePoint as Curve>::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§fn default() -> ProjectivePoint
fn default() -> ProjectivePoint
Returns the “default value” for a type. Read more
Source§impl From<&AffinePoint> for ProjectivePoint
impl From<&AffinePoint> for ProjectivePoint
Source§fn from(p: &AffinePoint) -> ProjectivePoint
fn from(p: &AffinePoint) -> ProjectivePoint
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<AffinePoint> for ProjectivePoint
impl From<AffinePoint> for ProjectivePoint
Source§fn from(p: AffinePoint) -> ProjectivePoint
fn from(p: AffinePoint) -> ProjectivePoint
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 FromEncodedPoint<Secp256k1> for ProjectivePoint
impl FromEncodedPoint<Secp256k1> for ProjectivePoint
Source§fn from_encoded_point(
p: &EncodedPoint<<Secp256k1 as Curve>::FieldBytesSize>,
) -> CtOption<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
.Source§impl Group for ProjectivePoint
impl Group for ProjectivePoint
Source§fn random(rng: impl RngCore) -> ProjectivePoint
fn random(rng: impl RngCore) -> ProjectivePoint
Returns an element chosen uniformly at random from the non-identity elements of
this group. Read more
Source§fn identity() -> ProjectivePoint
fn identity() -> ProjectivePoint
Returns the additive identity, also known as the “neutral element”.
Source§fn generator() -> ProjectivePoint
fn generator() -> ProjectivePoint
Returns a fixed generator of the prime-order subgroup.
Source§fn is_identity(&self) -> Choice
fn is_identity(&self) -> Choice
Determines if this point is the identity.
Source§fn double(&self) -> ProjectivePoint
fn double(&self) -> ProjectivePoint
Doubles this element.
Source§impl GroupEncoding for ProjectivePoint
impl GroupEncoding for ProjectivePoint
Source§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: &<ProjectivePoint as GroupEncoding>::Repr,
) -> CtOption<ProjectivePoint>
fn from_bytes( bytes: &<ProjectivePoint as GroupEncoding>::Repr, ) -> CtOption<ProjectivePoint>
Attempts to deserialize a group element from its encoding.
Source§fn from_bytes_unchecked(
bytes: &<ProjectivePoint as GroupEncoding>::Repr,
) -> CtOption<ProjectivePoint>
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
Source§fn to_bytes(&self) -> <ProjectivePoint as GroupEncoding>::Repr
fn to_bytes(&self) -> <ProjectivePoint as GroupEncoding>::Repr
Converts this element into its byte encoding. This may or may not support
encoding the identity.
Source§impl LinearCombinationExt<[(ProjectivePoint, Scalar)]> for ProjectivePoint
impl LinearCombinationExt<[(ProjectivePoint, Scalar)]> for ProjectivePoint
Source§fn lincomb_ext(
points_and_scalars: &[(ProjectivePoint, Scalar)],
) -> ProjectivePoint
fn lincomb_ext( points_and_scalars: &[(ProjectivePoint, Scalar)], ) -> ProjectivePoint
Calculates
x1 * k1 + ... + xn * kn
.Source§impl<const N: usize> LinearCombinationExt<[(ProjectivePoint, Scalar); N]> for ProjectivePoint
impl<const N: usize> LinearCombinationExt<[(ProjectivePoint, Scalar); N]> for ProjectivePoint
Source§fn lincomb_ext(
points_and_scalars: &[(ProjectivePoint, Scalar); N],
) -> ProjectivePoint
fn lincomb_ext( points_and_scalars: &[(ProjectivePoint, Scalar); N], ) -> ProjectivePoint
Calculates
x1 * k1 + ... + xn * kn
.Source§impl Mul<&Scalar> for &ProjectivePoint
impl Mul<&Scalar> for &ProjectivePoint
Source§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
*
operator.Source§impl Mul<&Scalar> for ProjectivePoint
impl Mul<&Scalar> for ProjectivePoint
Source§type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the
*
operator.Source§impl Mul<Scalar> for ProjectivePoint
impl Mul<Scalar> for ProjectivePoint
Source§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
Source§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
Source§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§impl PartialEq<ProjectivePoint> for AffinePoint
impl PartialEq<ProjectivePoint> for AffinePoint
Source§impl PartialEq for ProjectivePoint
impl PartialEq 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
Source§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
Source§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
Source§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
Source§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
Source§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 for ProjectivePoint
impl Sub for ProjectivePoint
Source§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 for ProjectivePoint
impl SubAssign 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>(iter: I) -> ProjectivePointwhere
I: Iterator<Item = &'a ProjectivePoint>,
fn sum<I>(iter: I) -> ProjectivePointwhere
I: Iterator<Item = &'a ProjectivePoint>,
Takes an iterator and generates
Self
from the elements by “summing up”
the items.Source§impl Sum for ProjectivePoint
impl Sum for ProjectivePoint
Source§fn sum<I>(iter: I) -> ProjectivePointwhere
I: Iterator<Item = ProjectivePoint>,
fn sum<I>(iter: I) -> ProjectivePointwhere
I: Iterator<Item = ProjectivePoint>,
Takes an iterator and generates
Self
from the elements by “summing up”
the items.Source§impl ToEncodedPoint<Secp256k1> for ProjectivePoint
impl ToEncodedPoint<Secp256k1> for ProjectivePoint
Source§fn to_encoded_point(
&self,
compress: bool,
) -> EncodedPoint<<Secp256k1 as Curve>::FieldBytesSize>
fn to_encoded_point( &self, compress: bool, ) -> EncodedPoint<<Secp256k1 as Curve>::FieldBytesSize>
Serialize this value as a SEC1
EncodedPoint
, optionally applying
point compression.impl Copy for ProjectivePoint
impl DefaultIsZeroes for ProjectivePoint
impl Eq for ProjectivePoint
impl PrimeGroup for ProjectivePoint
Auto Trait Implementations§
impl Freeze for ProjectivePoint
impl RefUnwindSafe for ProjectivePoint
impl Send for ProjectivePoint
impl Sync for ProjectivePoint
impl Unpin for ProjectivePoint
impl UnwindSafe for ProjectivePoint
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