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 AlgorithmParameters for Secp256k1
impl AlgorithmParameters for Secp256k1
sourceconst OID: ObjectIdentifier
const OID: ObjectIdentifier
Object Identifier (OID) for this curve
sourcefn algorithm_identifier() -> AlgorithmIdentifier<'static>
fn algorithm_identifier() -> AlgorithmIdentifier<'static>
Get the pkcs8::AlgorithmIdentifier
for this curve
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
This is supported on crate features ecdsa-core
and sha256
only.
impl DigestPrimitive for Secp256k1
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
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>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
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 more
sourceimpl PointCompression for Secp256k1
impl PointCompression for Secp256k1
sourceconst COMPRESS_POINTS: bool
const COMPRESS_POINTS: bool
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
This is supported on crate feature ecdsa-core
only.
impl SignPrimitive<Secp256k1> for Scalar
ecdsa-core
only.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 more
sourceimpl 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 more
sourceimpl ToEncodedPoint<Secp256k1> for VerifyingKey
This is supported on crate feature ecdsa-core
only.
impl ToEncodedPoint<Secp256k1> for VerifyingKey
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 more
sourceimpl VerifyPrimitive<Secp256k1> for AffinePoint
This is supported on crate feature ecdsa-core
only.
impl VerifyPrimitive<Secp256k1> for AffinePoint
ecdsa-core
only.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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more