Struct k256::Secp256k1

source ·
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§

Elliptic curve point in affine coordinates.
Get the affine x-coordinate as a serialized field element.
The OID associated with this type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

256-bit field modulus

Curve order

Formats the value using the given formatter. Read more

Decompaction using Taproot conventions as described in BIP 340.

Attempt to decompact an elliptic curve point
Attempt to decompress an elliptic curve point.
Returns the “default value” for a type. Read more
Preferred digest to use when computing ECDSA signatures for this elliptic curve. This is typically a member of the SHA-2 family.

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

Returns

None value if encoded_point is not on the secp256k1 curve.

Deserialize the type this trait is impl’d on from an EncodedPoint.
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

secp256k1 points are typically compressed.

Prime order elliptic curve group.
Elliptic curve point in projective coordinates. Read more
Scalar field type. Read more
Try to sign the prehashed message. Read more
Serialize this value as a SEC1 EncodedPoint, optionally applying point compression.
Serialize this value as a SEC1 EncodedPoint, optionally applying point compression.
Verify the prehashed message against the provided signature Read more
Available on crate feature digest only.
Verify message digest against the provided signature.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Get the OID associated with this value.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.