#![no_std]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![doc = include_str!("../README.md")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg"
)]
#![allow(clippy::needless_range_loop)]
#![forbid(unsafe_code)]
#![warn(
clippy::mod_module_files,
clippy::unwrap_used,
missing_docs,
rust_2018_idioms,
unused_lifetimes,
unused_qualifications
)]
#[cfg(feature = "alloc")]
#[allow(unused_imports)]
#[macro_use]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
#[cfg(feature = "arithmetic")]
mod arithmetic;
#[cfg(feature = "ecdh")]
pub mod ecdh;
#[cfg(feature = "ecdsa-core")]
pub mod ecdsa;
#[cfg(feature = "schnorr")]
pub mod schnorr;
#[cfg(any(feature = "test-vectors", test))]
pub mod test_vectors;
#[cfg(feature = "hash2curve")]
pub use hash2curve;
pub use elliptic_curve::{self, bigint::U256};
#[cfg(feature = "arithmetic")]
pub use arithmetic::{affine::AffinePoint, projective::ProjectivePoint, scalar::Scalar};
#[cfg(feature = "pkcs8")]
pub use elliptic_curve::pkcs8;
#[cfg(feature = "sha2")]
pub use sha2;
use elliptic_curve::{
array::Array,
bigint::Odd,
consts::{U32, U33, U64},
};
const ORDER_HEX: &str = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141";
const ORDER: Odd<U256> = Odd::<U256>::from_be_hex(ORDER_HEX);
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, PartialOrd, Ord)]
pub struct Secp256k1;
impl elliptic_curve::Curve for Secp256k1 {
type FieldBytesSize = U32;
type Uint = U256;
const ORDER: Odd<U256> = ORDER;
}
impl elliptic_curve::PrimeCurve for Secp256k1 {}
impl elliptic_curve::point::PointCompression for Secp256k1 {
const COMPRESS_POINTS: bool = true;
}
#[cfg(feature = "pkcs8")]
impl pkcs8::AssociatedOid for Secp256k1 {
const OID: pkcs8::ObjectIdentifier = pkcs8::ObjectIdentifier::new_unwrap("1.3.132.0.10");
}
pub type CompressedPoint = Array<u8, U33>;
pub type Sec1Point = elliptic_curve::sec1::Sec1Point<Secp256k1>;
pub type FieldBytes = elliptic_curve::FieldBytes<Secp256k1>;
pub type WideBytes = Array<u8, U64>;
#[cfg(feature = "arithmetic")]
pub type NonZeroScalar = elliptic_curve::NonZeroScalar<Secp256k1>;
#[cfg(feature = "arithmetic")]
pub type PublicKey = elliptic_curve::PublicKey<Secp256k1>;
pub type SecretKey = elliptic_curve::SecretKey<Secp256k1>;
#[cfg(not(feature = "arithmetic"))]
impl elliptic_curve::sec1::ValidatePublicKey for Secp256k1 {}