Curve1024 is a complete, from-scratch 1024-bit Elliptic Curve Cryptography (ECC) library written purely in Rust. Designed with cryptographic sovereignty and memory safety at its core, Curve1024 relies on zero external cryptographic dependencies.
By utilizing a monstrous 1024-bit base field (
-
Pure-Rust 1024-bit BigNum Arithmetic (
U1024): Custom, memory-safe large integer operations over 1024-bit fields, circumventing vulnerabilities inherent in legacy C/C++ implementations. - 1024-bit Elliptic Curve: Pre-computed curve parameters with CM discriminant D=−3, embedding degree k=18, and a 512-bit scalar field providing 256-bit symmetric security.
- Optimized Field Arithmetic: Heavily utilizes Montgomery multiplication to bypass expensive large-integer divisions, ensuring a viable performance-to-security trade-off.
- Complex Multiplication (CM): Constructs the curve equation and generator point from CM parameters using Hilbert class polynomials, sextic twist enumeration, and cofactor clearing.
- Cross-validated with BLS12-381: Library correctness is independently verified against the well-known zkcrypto/bls12_381 test vectors.
-
Robust Attack Resistance:
-
Pollard's rho: Requires
$O(2^{256})$ operations. -
MOV Attack: The extension field
$\mathbb{F}_{p^{18}}$ is a massive 18,432 bits, making index-calculus DLP infeasible. -
Anomalous (SSSA): Curve cardinality is rigorously checked (
$#E(\mathbb{F}_p) \neq p$ ).
-
Pollard's rho: Requires
- GPG-like Interface: An intuitive command-line interface for managing keys and signing/verifying files.
- Multiple Signature Schemes: Offers drop-in support for both Schnorr and ECDSA digital signature algorithms out of the box.
- File Signatures: Directly signs files, appending the signature securely to the file with a specific magic footer identifying the schema.
Add curve1024 to your Cargo.toml dependencies.
use curve1024::{
AffinePoint, Curve1024BaseField, Curve1024Config, EcdsaSignature, KeyPair,
PrimeFieldElement, SchnorrSignature, U1024,
};
fn main() {
// 1. Generate a new 1024-bit keypair
let keypair = KeyPair::<Curve1024Config>::generate();
let message = b"Confidential system payload";
// 2. Sign using Schnorr
let schnorr_sig = SchnorrSignature::<Curve1024Config>::sign(&keypair.private_key, message);
let schnorr_valid = schnorr_sig.verify(&keypair.public_key, message);
assert!(schnorr_valid);
// 3. Or sign using ECDSA
let ecdsa_sig = EcdsaSignature::sign::<Curve1024Config>(&keypair.private_key, message);
let ecdsa_valid = ecdsa_sig.verify::<Curve1024Config>(&keypair.public_key, message);
assert!(ecdsa_valid);
}You can install the CLI tool directly from the repository using cargo install.
cargo install --git https://github.com/Tranduy1dol/curve1024.git curve1024-sigAlternatively, you can build it from source:
git clone https://github.com/Tranduy1dol/curve1024.git
cd curve1024
cargo build --releaseCLI Commands Overview:
A GPG-like tool for elliptic curve key management and digital signatures
Usage: curve1024-sig <COMMAND>
Commands:
keygen
sign
verify
export-pub
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
Warning & Academic Transparency: While this library achieves high mathematical correctness and effectively neutralizes standard algorithmic attacks, the scalar multiplication algorithm currently leverages a Double-and-Add approach. Thus, it may be vulnerable to timing side-channel attacks. Curve1024 is currently best suited for academic demonstrations, secure protocol designs, and offline signing operations.
This project is open-source and strictly licensed under the MIT License.