pub struct Secp256k1;
Expand description
secp256k1 (K-256) elliptic curve.
Specified in Certicom’s SECG in “SEC 2: Recommended Elliptic Curve Domain Parameters”:
https://www.secg.org/sec2-v2.pdf
The curve’s equation is y² = x³ + 7
over a ~256-bit prime field.
It’s primarily notable for usage in Bitcoin and other cryptocurrencies, particularly in conjunction with the Elliptic Curve Digital Signature Algorithm (ECDSA).
Trait Implementations
sourceimpl AffineArithmetic for Secp256k1
impl AffineArithmetic for Secp256k1
type AffinePoint = AffinePoint
type AffinePoint = AffinePoint
Elliptic curve point in affine coordinates.
sourceimpl AffineXCoordinate<Secp256k1> for AffinePoint
impl AffineXCoordinate<Secp256k1> for AffinePoint
sourcefn x(&self) -> FieldBytes
fn x(&self) -> FieldBytes
Get the affine x-coordinate as a serialized field element.
sourceimpl AssociatedOid for Secp256k1
impl AssociatedOid for Secp256k1
sourceconst OID: ObjectIdentifier = _
const OID: ObjectIdentifier = _
The OID associated with this type.
sourceimpl DecompactPoint<Secp256k1> for AffinePoint
impl DecompactPoint<Secp256k1> for AffinePoint
Decompaction using Taproot conventions as described in BIP 340.
sourcefn decompact(x_bytes: &FieldBytes) -> CtOption<Self>
fn decompact(x_bytes: &FieldBytes) -> CtOption<Self>
Attempt to decompact an elliptic curve point
sourceimpl DecompressPoint<Secp256k1> for AffinePoint
impl DecompressPoint<Secp256k1> for AffinePoint
sourcefn decompress(x_bytes: &FieldBytes, y_is_odd: Choice) -> CtOption<Self>
fn decompress(x_bytes: &FieldBytes, y_is_odd: Choice) -> CtOption<Self>
Attempt to decompress an elliptic curve point.
sourceimpl DigestPrimitive for Secp256k1
Available on crate features ecdsa-core
and sha256
only.
impl DigestPrimitive for Secp256k1
Available on crate features
ecdsa-core
and sha256
only.sourceimpl FromEncodedPoint<Secp256k1> for AffinePoint
impl FromEncodedPoint<Secp256k1> for AffinePoint
sourcefn from_encoded_point(encoded_point: &EncodedPoint) -> CtOption<Self>
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.
sourceimpl FromEncodedPoint<Secp256k1> for ProjectivePoint
impl FromEncodedPoint<Secp256k1> for ProjectivePoint
sourcefn 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
.sourceimpl Ord for Secp256k1
impl Ord for Secp256k1
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<Secp256k1> for Secp256k1
impl PartialOrd<Secp256k1> for Secp256k1
sourcefn partial_cmp(&self, other: &Secp256k1) -> Option<Ordering>
fn partial_cmp(&self, other: &Secp256k1) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresourceimpl PointCompression for Secp256k1
impl PointCompression for Secp256k1
sourceconst COMPRESS_POINTS: bool = true
const COMPRESS_POINTS: bool = true
secp256k1 points are typically compressed.
sourceimpl PrimeCurveArithmetic for Secp256k1
impl PrimeCurveArithmetic for Secp256k1
type CurveGroup = ProjectivePoint
type CurveGroup = ProjectivePoint
Prime order elliptic curve group.
sourceimpl ProjectiveArithmetic for Secp256k1
impl ProjectiveArithmetic for Secp256k1
type ProjectivePoint = ProjectivePoint
type ProjectivePoint = ProjectivePoint
Elliptic curve point in projective coordinates. Read more
sourceimpl SignPrimitive<Secp256k1> for Scalar
Available on crate feature ecdsa-core
only.
impl SignPrimitive<Secp256k1> for Scalar
Available on crate feature
ecdsa-core
only.sourcefn try_sign_prehashed<K>(
&self,
ephemeral_scalar: K,
z: FieldBytes
) -> Result<(Signature, Option<RecoveryId>), Error>where
K: Borrow<Scalar> + Invert<Output = CtOption<Scalar>>,
fn try_sign_prehashed<K>(
&self,
ephemeral_scalar: K,
z: FieldBytes
) -> Result<(Signature, Option<RecoveryId>), Error>where
K: Borrow<Scalar> + Invert<Output = CtOption<Scalar>>,
Try to sign the prehashed message. Read more
sourceimpl ToEncodedPoint<Secp256k1> for AffinePoint
impl ToEncodedPoint<Secp256k1> for AffinePoint
sourcefn 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. Read moresourceimpl ToEncodedPoint<Secp256k1> for ProjectivePoint
impl ToEncodedPoint<Secp256k1> for ProjectivePoint
sourcefn 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. Read moresourceimpl ToEncodedPoint<Secp256k1> for VerifyingKey
Available on crate feature ecdsa-core
only.
impl ToEncodedPoint<Secp256k1> for VerifyingKey
Available on crate feature
ecdsa-core
only.sourcefn 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. Read moresourceimpl VerifyPrimitive<Secp256k1> for AffinePoint
Available on crate feature ecdsa-core
only.
impl VerifyPrimitive<Secp256k1> for AffinePoint
Available on crate feature
ecdsa-core
only.sourcefn verify_prehashed(&self, z: FieldBytes, signature: &Signature) -> Result<()>
fn verify_prehashed(&self, z: FieldBytes, signature: &Signature) -> Result<()>
Verify the prehashed message against the provided signature Read more
impl Copy for Secp256k1
impl Eq for Secp256k1
impl PrimeCurve for Secp256k1
impl StructuralEq for Secp256k1
impl StructuralPartialEq for Secp256k1
Auto Trait Implementations
impl RefUnwindSafe for Secp256k1
impl Send for Secp256k1
impl Sync for Secp256k1
impl Unpin for Secp256k1
impl UnwindSafe for Secp256k1
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more