Crates.io | eczkp |
lib.rs | eczkp |
version | 0.1.1 |
source | src |
created_at | 2024-09-17 17:50:51.938571 |
updated_at | 2024-09-17 22:47:33.632051 |
description | A library for Zero Knowledge Proof protocols using elliptic curves |
homepage | |
repository | https://github.com/lucasmdjl/eczkp |
max_upload_size | |
id | 1377784 |
size | 66,655 |
eczkp
is a Rust library that implements zero-knowledge proofs (ZKP) using elliptic curve cryptography.
It enables one party (the prover) to prove knowledge of a secret without revealing it, while the other party (the verifier)
can verify the proof without learning the secret.
Currently, eczkp
supports the following ZKP protocols:
elliptic_curve
crate, making the protocol secure and efficient.zeroize
crate to ensure secret data (such as private keys and nonces) is securely wiped from memory after use.Add the following to your Cargo.toml
file:
[dependencies]
eczkp = "0.1.1"
Below is a simple example showing how to use eczkp
to perform a zero-knowledge proof.
use eczkp::schnorr::ec::{SchnorrECProver, SchnorrECVerifier};
use eczkp::traits::{Prover, Verifier};
use elliptic_curve::SecretKey;
use rand::rngs::OsRng;
use p256::NistP256;
fn main() {
// Generate a new secret key and public key
let secret_key = SecretKey::<NistP256>::random(&mut OsRng);
let public_key = secret_key.public_key();
// Prover creates a commitment
let prover = SchnorrECProver::new(&secret_key, &mut OsRng);
let commitment = prover.commitment();
// Verifier generates a random challenge
let verifier = SchnorrECVerifier::new(&public_key, commitment, &mut OsRng);
let challenge = verifier.challenge();
// Prover answers the challenge
let answer = prover.answer(challenge);
// Verifier verifies the proof
assert!(verifier.verify(answer).is_ok());
}
For more details about the API, please refer to the RustDoc documentation.
In a typical ZKP protocol:
This library implements the above using elliptic curve cryptography, providing safe and efficient abstractions for both the prover and verifier.
elliptic_curve
: Provides elliptic curve cryptographic operations.zeroize
: Ensures that sensitive data is securely wiped from memory after use.rand_core
: Provides traits for secure random number generators.This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request if you find any bugs or want to propose features.
elliptic_curve
, zeroize
and rand_core
for providing the core libraries this project is built on.Feel free to reach out for any help or questions!