qzkp 0.1.0

Quantum Zero-Knowledge Proof protocol with BB84 simulation and Aadhaar identity verification
Documentation
  • Coverage
  • 98.63%
    72 out of 73 items documented5 out of 32 items with examples
  • Size
  • Source code size: 52.38 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.08 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • vrag99

qzkp

Crates.io docs.rs MIT licensed

Quantum Zero-Knowledge Proof (QZKP) protocol implementation in Rust, featuring BB84 quantum key distribution simulation and Aadhaar identity verification.

Features

  • Quantum simulation -- single-qubit state-vector simulator with depolarizing noise and amplitude damping channels
  • BB84 QKD -- full BB84 protocol: encode, transmit, measure, sift, estimate error rate
  • QZKP protocol -- SHA-256 KDF, quantum state preparation, basis reconciliation, QBER threshold verification
  • Aadhaar integration -- challenge-response identity verification with masked IDs, Merkle root over attributes, and proof generation/verification

Quick start

Add to your Cargo.toml:

[dependencies]
qzkp = "0.1"

QZKP proof verification

use qzkp::qzkp::QZKPProtocol;

let protocol = QZKPProtocol::new(
    "shared_secret".into(),
    "shared_secret".into(),
    32,
    0.025,
);
let result = protocol.run_protocol(&mut rand::thread_rng());
assert!(result.verification_status);
assert!(result.qber < 0.11);

Aadhaar authentication

use std::collections::BTreeMap;
use qzkp::qaadhaar::{QAadhaarProtocol, ServiceProvider};

let mut attrs = BTreeMap::new();
attrs.insert("name".into(), "Alice".into());
attrs.insert("age".into(), "25".into());

let proto = QAadhaarProtocol::new(
    "1234-5678-9012".into(),
    "master_secret".into(),
    attrs,
);

let mut rng = rand::thread_rng();
let challenge = proto.request_authentication("Gov Portal", "id_verify", &mut rng);
let (proof, result) = proto.generate_proof(&challenge, 0.025, &mut rng);

let verifier = ServiceProvider::new("Gov Portal".into());
assert!(verifier.verify_proof(&proof));

BB84 key distribution

use qzkp::bb84::BB84QKD;

let bb84 = BB84QKD::new(100, 0.02);
let (key_alice, key_bob, error_rate) = bb84.generate_key(&mut rand::thread_rng());
assert!(error_rate < 0.11);

Modules

Module Description
quantum QuantumState, QuantumCircuit -- gates, noise, measurement
bb84 BB84QKD -- BB84 quantum key distribution
qzkp QZKPProtocol, ProtocolResult -- full QZKP protocol
qaadhaar QAadhaarProtocol, AuthChallenge, AuthProof, ServiceProvider

Python bindings

A Python package wrapping this crate is available:

pip install qzkp

See PyPI for details.

License

MIT