Struct k256::AffinePoint

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

secp256k1 curve point expressed in affine coordinates.

serde support

When the serde feature of this crate is enabled, the Serialize and Deserialize traits are impl’d for this type.

The serialization uses the SEC1 Elliptic-Curve-Point-to-Octet-String encoding, serialized as binary.

When serialized with a text-based format, the SEC1 representation is subsequently hex encoded.

Implementations§

source§

impl AffinePoint

source

pub const IDENTITY: Self = _

Additive identity of the group: the point at infinity.

source

pub const GENERATOR: Self = _

Base point of secp256k1.

Gₓ = 79be667e f9dcbbac 55a06295 ce870b07 029bfcdb 2dce28d9 59f2815b 16f81798
Gᵧ = 483ada77 26a3c465 5da4fbfc 0e1108a8 fd17b448 a6855419 9c47d08f fb10d4b8

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<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 AddAssign<&AffinePoint> for ProjectivePoint

source§

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

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 AffineCoordinates for AffinePoint

§

type FieldRepr = GenericArray<u8, <Secp256k1 as Curve>::FieldBytesSize>

Field element representation.
source§

fn x(&self) -> FieldBytes

Get the affine x-coordinate as a serialized field element.
source§

fn y_is_odd(&self) -> Choice

Is the affine y-coordinate odd?
source§

impl Clone for AffinePoint

source§

fn clone(&self) -> AffinePoint

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 AffinePoint

source§

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

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 AffinePoint

source§

fn ct_eq(&self, other: &AffinePoint) -> 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 Debug for AffinePoint

source§

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

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

impl DecompactPoint<Secp256k1> for AffinePoint

Decompaction using Taproot conventions as described in BIP 340.

source§

fn decompact(x_bytes: &FieldBytes) -> CtOption<Self>

Attempt to decompact an elliptic curve point
source§

impl DecompressPoint<Secp256k1> for AffinePoint

source§

fn decompress(x_bytes: &FieldBytes, y_is_odd: Choice) -> CtOption<Self>

Attempt to decompress an elliptic curve point.
source§

impl Default for AffinePoint

source§

fn default() -> Self

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

impl From<&AffinePoint> for EncodedPoint

source§

fn from(affine_point: &AffinePoint) -> EncodedPoint

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<&AffinePoint> for SharedSecret

Available on crate feature ecdh only.
source§

fn from(affine: &AffinePoint) -> SharedSecret

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 AffinePoint

source§

fn from(public_key: &PublicKey) -> AffinePoint

Converts to this type from the input type.
source§

impl From<&VerifyingKey> for AffinePoint

Available on crate feature schnorr only.
source§

fn from(vk: &VerifyingKey) -> AffinePoint

Converts to this type from the input type.
source§

impl From<AffinePoint> for EncodedPoint

source§

fn from(affine_point: AffinePoint) -> EncodedPoint

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 AffinePoint

source§

fn from(public_key: PublicKey) -> AffinePoint

Converts to this type from the input type.
source§

impl From<VerifyingKey> for AffinePoint

Available on crate feature schnorr only.
source§

fn from(vk: VerifyingKey) -> AffinePoint

Converts to this type from the input type.
source§

impl FromEncodedPoint<Secp256k1> for AffinePoint

source§

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

Attempts to parse the given EncodedPoint as an SEC1-encoded AffinePoint.

Returns

None value if encoded_point is not on the secp256k1 curve.

source§

impl GroupEncoding for AffinePoint

§

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 Mul<&Scalar> for AffinePoint

§

type Output = ProjectivePoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<Scalar> for AffinePoint

§

type Output = ProjectivePoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Neg for AffinePoint

§

type Output = AffinePoint

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

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 AffinePoint

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 PrimeCurveAffine for AffinePoint

source§

fn identity() -> Self

Returns the identity of the group: the point at infinity.

source§

fn generator() -> Self

Returns the base point of secp256k1.

source§

fn is_identity(&self) -> Choice

Is this point the identity point?

source§

fn to_curve(&self) -> ProjectivePoint

Convert to curve representation.

§

type Scalar = Scalar

§

type Curve = 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<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 SubAssign<&AffinePoint> for ProjectivePoint

source§

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

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 ToEncodedPoint<Secp256k1> for AffinePoint

source§

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

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

impl TryFrom<&AffinePoint> for PublicKey

§

type Error = Error

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

fn try_from(affine_point: &AffinePoint) -> Result<PublicKey>

Performs the conversion.
source§

impl TryFrom<&EncodedPoint<<Secp256k1 as Curve>::FieldBytesSize>> for AffinePoint

§

type Error = Error

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

fn try_from(point: &EncodedPoint) -> Result<AffinePoint>

Performs the conversion.
source§

impl TryFrom<AffinePoint> for PublicKey

§

type Error = Error

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

fn try_from(affine_point: AffinePoint) -> Result<PublicKey>

Performs the conversion.
source§

impl TryFrom<EncodedPoint<<Secp256k1 as Curve>::FieldBytesSize>> for AffinePoint

§

type Error = Error

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

fn try_from(point: EncodedPoint) -> Result<AffinePoint>

Performs the conversion.
source§

impl VerifyPrimitive<Secp256k1> for AffinePoint

Available on crate features ecdsa-core and ecdsa only.
source§

fn verify_prehashed(&self, z: &FieldBytes, sig: &Signature) -> Result<(), Error>

Verify the prehashed message against the provided ECDSA signature. Read more
source§

fn verify_digest<D>( &self, msg_digest: D, sig: &Signature<C> ) -> Result<(), Error>
where D: FixedOutput<OutputSize = <C as Curve>::FieldBytesSize>,

Available on crate feature digest only.
Verify message digest against the provided signature.
source§

impl Copy for AffinePoint

source§

impl DefaultIsZeroes for AffinePoint

source§

impl Eq for AffinePoint

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