dcrypt_algorithms/ec/mod.rs
1// File: crates/algorithms/src/ec/mod.rs
2//! Elliptic Curve Primitives
3//!
4//! This module provides constant-time implementations of elliptic curve operations
5//! on NIST curves P-224, P-256, P-384, and P-521. These implementations are designed
6//! to be resistant to timing attacks and provide a foundation for higher-level
7//! protocols like ECDH-KEM.
8//! This module now also includes support for Koblitz (secp256k1) and Binary (sect283k1) curves.
9
10pub mod b283k;
11pub mod k256; // For secp256k1
12pub mod p192;
13pub mod p224;
14pub mod p256;
15pub mod p384;
16pub mod p521; // For sect283k1
17
18// Re-export common types
19pub use b283k::{Point as B283kPoint, Scalar as B283kScalar};
20pub use k256::{Point as K256Point, Scalar as K256Scalar};
21pub use p192::{Point as P192Point, Scalar as P192Scalar};
22pub use p224::{Point as P224Point, Scalar as P224Scalar};
23pub use p256::{Point as P256Point, Scalar as P256Scalar};
24pub use p384::{Point as P384Point, Scalar as P384Scalar};
25pub use p521::{Point as P521Point, Scalar as P521Scalar};
26
27/// Common trait for coordinate systems used in elliptic curve operations
28pub trait CoordinateSystem {}
29
30/// Affine coordinates (x,y)
31pub struct Affine;
32impl CoordinateSystem for Affine {}
33
34/// Jacobian projective coordinates (X:Y:Z) where x = X/Z² and y = Y/Z³
35pub struct Jacobian;
36impl CoordinateSystem for Jacobian {}