Skip to main content

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

Build Status License

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 -O3 with architecture-specific tuning
  • Python C extension (kyber_pqc._native) — no kyber-py dependency
  • Go cgo bindings to the same static library — no circl dependency
  • 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

Throughput Scaling

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

  1. Fork repository
  2. Create feature branch (git checkout -b feature)
  3. Commit changes (git commit -am 'Add feature')
  4. Push to branch (git push origin feature)
  5. 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.

Metadata

Release files for kyber-pqc 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for kyber-pqc 2.0.0
File Interpreter ABI Platform
kyber_pqc-2.0.0-cp310-cp310-macosx_26_0_arm64.whl CPython 3.10 CPython 3.10 macOS 26.0+ ARM64 Details

Release files / kyber_pqc-2.0.0-cp310-cp310-macosx_26_0_arm64.whl

Download URL kyber_pqc-2.0.0-cp310-cp310-macosx_26_0_arm64.whl
Size 28.5 kB
Tags CPython 3.10 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
5d5bced76b778a4aaba9b33c406e6cd5cbe9d365da4ec4102833efa47f1390a6
BLAKE2b-256 checksum
How to use checksums
fbb17c255483930e86f3408048b0c1d849302a8269a723f4440ba829a19895bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Release history Release notifications | RSS feed

This release

2.0.0 This release

1 release file

1.0.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page