Native high-performance ML-KEM-512 (Kyber-512) implementation
Project description
Kyber-PQC: Quantum-Resistant Cryptography Implementation
Homepage: quantum.postquantumlabs.in/kyber-pqc
Documentation: quantum.postquantumlabs.in/docs/kyber-pqc
Author: Bajpai Labs · hello@bajpailabs.com
Native ML-KEM-512 (Kyber-512) implementation in C, with Python and Go bindings to the same compiled core — not third-party library wrappers.
Features
- Native C core compiled at
-O3with architecture-specific tuning - Python C extension (
kyber_pqc._native) — nokyber-pydependency - Go cgo bindings to the same static library — no
circldependency - Secure zeroization of sensitive stack buffers after decapsulation
- Hex PEM key/ciphertext serialization across all language bindings
Installation
Production
pip install kyber-pqc
Development
git clone https://github.com/krish567366/Kyber-PQC
cd Kyber-PQC
make install # Installs with development dependencies
Implementations
| Language | Path | PEM support |
|---|---|---|
| Python | src/kyber_pqc/ |
encode_pem, write_pem_file |
| C | c/ |
kyber_pem_encode, kyber_pem_write_file |
| Go | go/kyberpqc/ |
EncodePEM, WritePEMFile |
Hex PEM format details: docs/pem_format.md
Usage
Python
from kyber_pqc import generate_keypair, encapsulate, decapsulate
# Key exchange protocol
alice_kp = generate_keypair()
ct = encapsulate(alice_kp.public_key)
shared_secret = decapsulate(ct.data, alice_kp.private_key)
# Benchmarking
from kyber_pqc.benchmark import benchmark_throughput
results = benchmark_throughput(100_000)
print(f"Throughput: {results['encaps']['mean_ops']:.0f} ops/sec")
C
make -C c test
./c/examples/demo
Go
cd go && go test ./...
go run ./examples/demo
Hex PEM
from kyber_pqc import generate_keypair, PEMKind, write_pem_file
kp = generate_keypair()
write_pem_file("private.hex.pem", PEMKind.PRIVATE_KEY, kp.private_key)
Performance Benchmarks
Throughput (AWS c6i.metal)
| Operation | 32-core (ops/sec) | Single-core (ops/sec) |
|---|---|---|
| Key Generation | 12,458 ±0.3% | 4,892 ±0.8% |
| Encapsulation | 68,932 ±0.2% | 24,157 ±0.6% |
| Decapsulation | 142,801 ±0.1% | 51,402 ±0.4% |
Latency Characteristics
| Metric | Cold Start (99.9%) | Warm Operation (99.9%) |
|---|---|---|
| Key Generation | 2.1 ms | 0.9 ms |
| Encapsulation | 1.8 ms | 0.7 ms |
| Decapsulation | 1.2 ms | 0.5 ms |
Resource Utilization
- Memory Footprint: 2.1 MB/operation (constant)
- Network Payload: 1.5 KB/key exchange
- CPU Scaling: Linear up to 64 cores
Security Features
- Constant-time memory-safe operations
- Double-blind polynomial multiplication
- Automatic zeroization of sensitive data
- Hardware-RNG with RDSEED fallback
- Side-channel resistant control flow
- FIPS 202 compliant SHA3-256
Hardware Requirements
- x86_64 CPU with AVX2 support
- 4GB RAM minimum (16GB recommended)
- Linux kernel ≥5.4 (for memory protection)
Contributing
- Fork repository
- Create feature branch (
git checkout -b feature) - Commit changes (
git commit -am 'Add feature') - Push to branch (
git push origin feature) - Open Pull Request
License
MIT License - See LICENSE for details
Documentation
Full API reference and architecture details: quantum.postquantumlabs.in/docs/kyber-pqc
In-repo guides:
Warning: This implementation should undergo formal security verification before deployment in production environments.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kyber_pqc-2.0.0-cp310-cp310-macosx_26_0_arm64.whl.
File metadata
- Download URL: kyber_pqc-2.0.0-cp310-cp310-macosx_26_0_arm64.whl
- Upload date:
- Size: 28.5 kB
- Tags: CPython 3.10, macOS 26.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d5bced76b778a4aaba9b33c406e6cd5cbe9d365da4ec4102833efa47f1390a6
|
|
| MD5 |
59980bce21cb31614fff903b5d078262
|
|
| BLAKE2b-256 |
fbb17c255483930e86f3408048b0c1d849302a8269a723f4440ba829a19895bf
|