1#![no_std]
5extern crate alloc;
6
7use elliptic_curve::{consts::U32, point::PointCompression, Curve, CurveArithmetic, PrimeCurve};
8
9mod coord;
10mod internal;
11mod point;
12mod scalar;
13
14#[cfg(feature = "ecdsa-core")]
15pub mod ecdsa;
16
17pub use elliptic_curve::{self, bigint::U256};
18pub use internal::{
20 Secp256k1Coord, Secp256k1Point, Secp256k1Point as AffinePoint,
21 Secp256k1Point as ProjectivePoint, Secp256k1Scalar as Scalar, Secp256k1Scalar,
22};
23
24#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, PartialOrd, Ord)]
26pub struct Secp256k1;
27
28const ORDER_HEX: &str = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141";
32
33const ORDER: U256 = U256::from_be_hex(ORDER_HEX);
35
36impl Curve for Secp256k1 {
37 type FieldBytesSize = U32;
39
40 type Uint = U256;
42
43 const ORDER: U256 = ORDER;
45}
46
47impl PrimeCurve for Secp256k1 {}
48
49impl CurveArithmetic for Secp256k1 {
50 type AffinePoint = AffinePoint;
51 type ProjectivePoint = ProjectivePoint;
52 type Scalar = Scalar;
53}
54
55impl PointCompression for Secp256k1 {
56 const COMPRESS_POINTS: bool = true;
58}
59
60pub type EncodedPoint = elliptic_curve::sec1::EncodedPoint<Secp256k1>;