Quantumcryptlib
QuantumCryptLib is a post-quantum cryptography library built in Rust, implementing Kyber512 for secure key exchange, encryption, and decryption. It ensures quantum-resistant security against future quantum computing threats.
Install / Use
/learn @0rlych1kk4/QuantumcryptlibREADME
QuantumCryptLib is a Rust library for building post-quantum secure communication channels using Kyber512 (a NIST-selected post-quantum Key Encapsulation Mechanism) combined with modern AEAD encryption.
Rather than encrypting data directly with Kyber, this library follows industry-correct cryptographic design:
Kyber KEM → Shared Secret → AEAD (ChaCha20-Poly1305)
This approach protects today’s communications and stored data against future quantum attacks (“harvest now, decrypt later”).
Key Capabilities
- Post-quantum key establishment using Kyber512 (KEM)
- Shared secret derivation for secure sessions
- Authenticated encryption via ChaCha20-Poly1305
- Fully tested secure channel handshake
- Written in Rust 2021 for safety and performance
Cryptographic Model (Important)
Kyber512 is a Key Encapsulation Mechanism (KEM) — it is not used to encrypt application data directly.
QuantumCryptLib implements the recommended construction:
- Key Encapsulation (Kyber512)
Establishes a shared secret between two parties - Key Derivation
Derives a symmetric encryption key from the shared secret - AEAD Encryption (ChaCha20-Poly1305)
Encrypts and authenticates application data
This model is used in:
- Post-quantum TLS / mTLS
- Zero-Trust service-to-service communication
- Secure tunnels and long-term data protection
Real-World Use Cases
- Post-Quantum Secure Channels (TLS / mTLS alternatives)
- Zero-Trust Microservices Communication
- Long-Term Data Protection & Archival Encryption
- Financial, Government, and Critical Infrastructure Systems
- Blockchain & Distributed System Secure Messaging
Installation
️⃣ Clone the repository:
git clone https://github.com/0rlych1kk4/quantumcryptlib.git
cd quantumcryptlib
Build project:
cargo build
cargo run --bin quantumcryptlib_bin
Usage
Generating Kyber Key Pair
use quantumcryptlib::key_exchange::generate_key_pair;
let (public_key, secret_key) = generate_key_pair();
Establish a Post-Quantum Shared Secret (KEM)
use quantumcryptlib::key_exchange::{encapsulate, decapsulate};
// Initiator
let (shared_secret_a, kem_ciphertext) = encapsulate(&public_key)?;
// Responder
let shared_secret_b = decapsulate(&secret_key, &kem_ciphertext)?;
assert_eq!(shared_secret_a, shared_secret_b);
**Encrypt and Decrypt Data Using AEAD**
use quantumcryptlib::secure_channel::{aead_encrypt, aead_decrypt};
let message = b"hello post-quantum world";
// Encrypt
let (nonce, ciphertext) = aead_encrypt(&shared_secret_a, message)?;
// Decrypt
let plaintext = aead_decrypt(&shared_secret_b, &nonce, &ciphertext)?;
assert_eq!(message.to_vec(), plaintext);
Testing
Integration tests validate the following:
- Multiple independent KEM handshakes
- Shared secret correctness
- AEAD encryption and decryption cycles
Run tests
cargo test
Security Notes
- Secrets are never printed
- AEAD ensures confidentiality and authenticity
- Kyber512 is NIST-selected for post-quantum key exchange
- This library is a secure communication building block, not a full TLS replacement
Planned Hardening
- HKDF
- Hybrid classical + post-quantum key exchange
- Secret zeroization
no_stdsupport
Contributing
- Fork the repository
- Create a feature branch
git checkout -b feature-branch - Commit your changes
git commit -m "Add feature" - Push and open a pull request
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
