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§
Source§impl AssociatedOid for Secp256k1
Available on crate feature pkcs8 only.
impl AssociatedOid for Secp256k1
pkcs8 only.Source§const OID: ObjectIdentifier
const OID: ObjectIdentifier
impl Copy for Secp256k1
Source§impl Curve for Secp256k1
impl Curve for Secp256k1
Source§impl CurveArithmetic for Secp256k1
impl CurveArithmetic for Secp256k1
Source§type AffinePoint = AffinePoint
type AffinePoint = AffinePoint
Source§type ProjectivePoint = ProjectivePoint
type ProjectivePoint = ProjectivePoint
Source§impl DecompactPoint<Secp256k1> for AffinePoint
Decompaction using Taproot conventions as described in BIP 340.
impl DecompactPoint<Secp256k1> for AffinePoint
Decompaction using Taproot conventions as described in BIP 340.
Source§fn decompact(x_bytes: &FieldBytes) -> CtOption<Self>
fn decompact(x_bytes: &FieldBytes) -> CtOption<Self>
Source§impl DecompressPoint<Secp256k1> for AffinePoint
impl DecompressPoint<Secp256k1> for AffinePoint
Source§fn decompress(x_bytes: &FieldBytes, y_is_odd: Choice) -> CtOption<Self>
fn decompress(x_bytes: &FieldBytes, y_is_odd: Choice) -> CtOption<Self>
Source§impl DigestAlgorithm for Secp256k1
Available on crate feature sha256 only.
impl DigestAlgorithm for Secp256k1
sha256 only.Source§impl EcdsaCurve for Secp256k1
impl EcdsaCurve for Secp256k1
Source§const NORMALIZE_S: bool = true
const NORMALIZE_S: bool = true
impl Eq for Secp256k1
Source§impl FieldArithmetic for Secp256k1
impl FieldArithmetic for Secp256k1
Source§type FieldElement = FieldElement
type FieldElement = FieldElement
Source§impl FromSec1Point<Secp256k1> for AffinePoint
impl FromSec1Point<Secp256k1> for AffinePoint
Source§fn from_sec1_point(encoded_point: &Sec1Point) -> CtOption<Self>
fn from_sec1_point(encoded_point: &Sec1Point) -> CtOption<Self>
Attempts to parse the given Sec1Point as an SEC1-encoded AffinePoint.
§Returns
None value if encoded_point is not on the secp256k1 curve.
Source§fn from_sec1_bytes(bytes: &[u8]) -> Result<Self, Error>
fn from_sec1_bytes(bytes: &[u8]) -> Result<Self, Error>
Octet-String-to-Elliptic-Curve-Point conversion. Read moreSource§fn from_encoded_point(
point: &EncodedPoint<<C as Curve>::FieldBytesSize>,
) -> CtOption<Self>
fn from_encoded_point( point: &EncodedPoint<<C as Curve>::FieldBytesSize>, ) -> CtOption<Self>
use FromSec1Point::from_sec1_point instead
FromSec1Point::from_sec1_point.Source§impl FromSec1Point<Secp256k1> for ProjectivePoint
impl FromSec1Point<Secp256k1> for ProjectivePoint
Source§fn from_sec1_bytes(bytes: &[u8]) -> Result<Self, Error>
fn from_sec1_bytes(bytes: &[u8]) -> Result<Self, Error>
Octet-String-to-Elliptic-Curve-Point conversion. Read moreSource§fn from_encoded_point(
point: &EncodedPoint<<C as Curve>::FieldBytesSize>,
) -> CtOption<Self>
fn from_encoded_point( point: &EncodedPoint<<C as Curve>::FieldBytesSize>, ) -> CtOption<Self>
use FromSec1Point::from_sec1_point instead
FromSec1Point::from_sec1_point.Source§impl Mul<&<Secp256k1 as CurveArithmetic>::AffinePoint> for Scalar
impl Mul<&<Secp256k1 as CurveArithmetic>::AffinePoint> for Scalar
Source§type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
* operator.Source§fn mul(self, rhs: &AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul(self, rhs: &AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
* operation. Read moreSource§impl Mul<&<Secp256k1 as CurveArithmetic>::AffinePoint> for &Scalar
impl Mul<&<Secp256k1 as CurveArithmetic>::AffinePoint> for &Scalar
Source§type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
* operator.Source§fn mul(self, rhs: &AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul(self, rhs: &AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
* operation. Read moreSource§impl Mul<&<Secp256k1 as CurveArithmetic>::ProjectivePoint> for Scalar
impl Mul<&<Secp256k1 as CurveArithmetic>::ProjectivePoint> for Scalar
Source§type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
* operator.Source§fn mul(self, rhs: &ProjectivePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul(self, rhs: &ProjectivePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
* operation. Read moreSource§impl Mul<&<Secp256k1 as CurveArithmetic>::ProjectivePoint> for &Scalar
impl Mul<&<Secp256k1 as CurveArithmetic>::ProjectivePoint> for &Scalar
Source§type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
* operator.Source§fn mul(self, rhs: &ProjectivePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul(self, rhs: &ProjectivePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
* operation. Read moreSource§impl Mul<<Secp256k1 as CurveArithmetic>::AffinePoint> for Scalar
impl Mul<<Secp256k1 as CurveArithmetic>::AffinePoint> for Scalar
Source§type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
* operator.Source§fn mul(self, rhs: AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul(self, rhs: AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
* operation. Read moreSource§impl Mul<<Secp256k1 as CurveArithmetic>::AffinePoint> for &Scalar
impl Mul<<Secp256k1 as CurveArithmetic>::AffinePoint> for &Scalar
Source§type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
* operator.Source§fn mul(self, rhs: AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul(self, rhs: AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
* operation. Read moreSource§impl Mul<<Secp256k1 as CurveArithmetic>::ProjectivePoint> for Scalar
impl Mul<<Secp256k1 as CurveArithmetic>::ProjectivePoint> for Scalar
Source§type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
* operator.Source§fn mul(self, rhs: ProjectivePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul(self, rhs: ProjectivePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
* operation. Read moreSource§impl Mul<<Secp256k1 as CurveArithmetic>::ProjectivePoint> for &Scalar
impl Mul<<Secp256k1 as CurveArithmetic>::ProjectivePoint> for &Scalar
Source§type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
type Output = <Secp256k1 as CurveArithmetic>::ProjectivePoint
* operator.Source§fn mul(self, rhs: ProjectivePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul(self, rhs: ProjectivePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
* operation. Read moreSource§impl MulVartime<&<Secp256k1 as CurveArithmetic>::AffinePoint> for Scalar
impl MulVartime<&<Secp256k1 as CurveArithmetic>::AffinePoint> for Scalar
Source§fn mul_vartime(self, rhs: &AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul_vartime(self, rhs: &AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
self by rhs in variable-time.Source§impl MulVartime<&<Secp256k1 as CurveArithmetic>::AffinePoint> for &Scalar
impl MulVartime<&<Secp256k1 as CurveArithmetic>::AffinePoint> for &Scalar
Source§fn mul_vartime(self, rhs: &AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul_vartime(self, rhs: &AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
self by rhs in variable-time.Source§impl MulVartime<&<Secp256k1 as CurveArithmetic>::ProjectivePoint> for Scalar
impl MulVartime<&<Secp256k1 as CurveArithmetic>::ProjectivePoint> for Scalar
Source§fn mul_vartime(
self,
rhs: &ProjectivePoint<Secp256k1>,
) -> ProjectivePoint<Secp256k1>
fn mul_vartime( self, rhs: &ProjectivePoint<Secp256k1>, ) -> ProjectivePoint<Secp256k1>
self by rhs in variable-time.Source§impl MulVartime<&<Secp256k1 as CurveArithmetic>::ProjectivePoint> for &Scalar
impl MulVartime<&<Secp256k1 as CurveArithmetic>::ProjectivePoint> for &Scalar
Source§fn mul_vartime(
self,
rhs: &ProjectivePoint<Secp256k1>,
) -> ProjectivePoint<Secp256k1>
fn mul_vartime( self, rhs: &ProjectivePoint<Secp256k1>, ) -> ProjectivePoint<Secp256k1>
self by rhs in variable-time.Source§impl MulVartime<<Secp256k1 as CurveArithmetic>::AffinePoint> for Scalar
impl MulVartime<<Secp256k1 as CurveArithmetic>::AffinePoint> for Scalar
Source§fn mul_vartime(self, rhs: AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul_vartime(self, rhs: AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
self by rhs in variable-time.Source§impl MulVartime<<Secp256k1 as CurveArithmetic>::AffinePoint> for &Scalar
impl MulVartime<<Secp256k1 as CurveArithmetic>::AffinePoint> for &Scalar
Source§fn mul_vartime(self, rhs: AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
fn mul_vartime(self, rhs: AffinePoint<Secp256k1>) -> ProjectivePoint<Secp256k1>
self by rhs in variable-time.Source§impl MulVartime<<Secp256k1 as CurveArithmetic>::ProjectivePoint> for Scalar
impl MulVartime<<Secp256k1 as CurveArithmetic>::ProjectivePoint> for Scalar
Source§fn mul_vartime(
self,
rhs: ProjectivePoint<Secp256k1>,
) -> ProjectivePoint<Secp256k1>
fn mul_vartime( self, rhs: ProjectivePoint<Secp256k1>, ) -> ProjectivePoint<Secp256k1>
self by rhs in variable-time.Source§impl MulVartime<<Secp256k1 as CurveArithmetic>::ProjectivePoint> for &Scalar
impl MulVartime<<Secp256k1 as CurveArithmetic>::ProjectivePoint> for &Scalar
Source§fn mul_vartime(
self,
rhs: ProjectivePoint<Secp256k1>,
) -> ProjectivePoint<Secp256k1>
fn mul_vartime( self, rhs: ProjectivePoint<Secp256k1>, ) -> ProjectivePoint<Secp256k1>
self by rhs in variable-time.Source§impl Ord for Secp256k1
impl Ord for Secp256k1
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Secp256k1
impl PartialOrd for Secp256k1
Source§impl PointCompression for Secp256k1
impl PointCompression for Secp256k1
Source§const COMPRESS_POINTS: bool = true
const COMPRESS_POINTS: bool = true
secp256k1 points are typically compressed.
impl PrimeCurve for Secp256k1
Source§impl PrimeCurveWithBasepointTable<WINDOW_SIZE> for Secp256k1
impl PrimeCurveWithBasepointTable<WINDOW_SIZE> for Secp256k1
Source§const BASEPOINT_TABLE: &'static BasepointTable<ProjectivePoint, WINDOW_SIZE>
const BASEPOINT_TABLE: &'static BasepointTable<ProjectivePoint, WINDOW_SIZE>
impl StructuralPartialEq for Secp256k1
Source§impl ToSec1Point<Secp256k1> for AffinePoint
impl ToSec1Point<Secp256k1> for AffinePoint
Source§fn to_sec1_point(&self, compress: bool) -> Sec1Point
fn to_sec1_point(&self, compress: bool) -> Sec1Point
Sec1Point, optionally applying point compression
according to the compress flag.Source§fn to_sec1_bytes(&self) -> Box<[u8]>where
C: PointCompression,
fn to_sec1_bytes(&self) -> Box<[u8]>where
C: PointCompression,
Elliptic-Curve-Point-to-Octet-String conversion and the
point compression default for this curve as specified by the PointCompression trait.Source§fn to_compressed_point(
&self,
) -> Array<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>
fn to_compressed_point( &self, ) -> Array<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>
CompressedPoint.Source§fn to_uncompressed_point(
&self,
) -> Array<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::UncompressedPointSize>
fn to_uncompressed_point( &self, ) -> Array<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::UncompressedPointSize>
CompressedPoint.Source§fn to_encoded_point(
&self,
compress: bool,
) -> EncodedPoint<<C as Curve>::FieldBytesSize>
fn to_encoded_point( &self, compress: bool, ) -> EncodedPoint<<C as Curve>::FieldBytesSize>
use ToSec1Point::to_sec1_point instead
ToSec1Point::to_sec1_point.Source§impl ToSec1Point<Secp256k1> for ProjectivePoint
impl ToSec1Point<Secp256k1> for ProjectivePoint
Source§fn to_sec1_point(&self, compress: bool) -> Sec1Point
fn to_sec1_point(&self, compress: bool) -> Sec1Point
Sec1Point, optionally applying point compression
according to the compress flag.Source§fn to_sec1_bytes(&self) -> Box<[u8]>where
C: PointCompression,
fn to_sec1_bytes(&self) -> Box<[u8]>where
C: PointCompression,
Elliptic-Curve-Point-to-Octet-String conversion and the
point compression default for this curve as specified by the PointCompression trait.Source§fn to_compressed_point(
&self,
) -> Array<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>
fn to_compressed_point( &self, ) -> Array<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>
CompressedPoint.Source§fn to_uncompressed_point(
&self,
) -> Array<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::UncompressedPointSize>
fn to_uncompressed_point( &self, ) -> Array<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::UncompressedPointSize>
CompressedPoint.Source§fn to_encoded_point(
&self,
compress: bool,
) -> EncodedPoint<<C as Curve>::FieldBytesSize>
fn to_encoded_point( &self, compress: bool, ) -> EncodedPoint<<C as Curve>::FieldBytesSize>
use ToSec1Point::to_sec1_point instead
ToSec1Point::to_sec1_point.