Post-quantum mesh VPN library with offline wallet generation via Dilithium5 and SHA3-512
Project description
๐ง pqbit
Post-quantum mesh VPN library with WireGuard, PQClean, Pyshark, Scapy, and Logging4 โ built for Bit512.
Author: Kito Hamachi โ Bit512 Labs
License: MIT
Repository: github.com/kitohamachi/pqbit
PyPI: pypi.org/project/pqbit
๐ฆ Installation
pip install pqbit
๐ Features
-
๐ Post-Quantum Cryptography: Kyber1024, Dilithium5, Falcon1024 via PQClean
-
๐ธ๏ธ Mesh VPN: WireGuard tunnels with automatic peer discovery and config
-
๐ฐ๏ธ Encrypted Broadcast: Kyber-encrypted discovery messages
-
๐งฌ Adaptive Routing: Based on entropy and latency
-
๐งญ Distributed Authentication: Falcon-signed peer validation
-
๐ต๏ธ Traffic Cloaking: Obfs4 + PySocks integration
-
๐ Live Monitoring: Real-time entropy, latency, and event logs via PyShark
-
๐ Offline Wallets: SHA3-512 + Dilithium5 for post-quantum identity generation
๐งช Usage Examples
๐ Falcon Signature
from pqbit import falcon_keypair, falcon_sign, falcon_verify
pk, sk = falcon_keypair()
message = b"Bit512 integrity test"
signature = falcon_sign(message, sk)
if falcon_verify(message, signature, pk):
print("Signature verified โ
")
๐ Wallet Generation (pqbit 1.2.0+)
from pqbit import generate_wallet, verify_wallet
wallet = generate_wallet()
print("Fingerprint:", wallet["public_key"])
print("Verificado:", verify_wallet(wallet))
๐งฉ Key Components
-
๐ Post-Quantum Cryptography
Kyber1024, Dilithium5, and Falcon1024 for quantum-resistant key exchange and digital signatures. -
๐ธ๏ธ Mesh VPN Architecture
WireGuard tunnels with automatic peer discovery, namespace support, and adaptive topology. -
๐ญ Distributed Authentication
Falcon-signed node identities with peer verification and audit logging. -
๐ Offline Wallets (v1.2.0+)
36-word seed phrases hashed with SHA3-512 and signed using Dilithium5. Enables portable, verifiable, post-quantum identities without exposing raw keys. -
๐ฐ๏ธ Encrypted Broadcast Channels
Kyber-encrypted discovery packets for secure mesh initialization and peer signaling. -
๐งฌ Entropy-Based Routing
Peer selection based on real-time entropy and latency metrics, optimizing for security and performance. -
๐ต๏ธ Traffic Cloaking & Proxying
Obfs4 integration with PySocks for stealth routing and anonymous overlays. -
๐ Live Monitoring & Inspection
Real-time packet analysis, entropy tracking, and event visualization via PyShark and Scapy.
๐ Modules Overview
โ
benchmark.py
Performs cryptographic performance tests across Kyber, Falcon, and Dilithium. Measures key generation time, signature throughput, and latency under simulated load.
โ
benchmark_routes.py
Evaluates routing performance across mesh paths. Calculates entropy, latency, and cloaking efficiency using synthetic traffic and randomized peer selection.
โ
dilithium.py
Implements Dilithium5 digital signatures via PQClean. Used for signing messages, identities, and wallet digests with post-quantum security guarantees.
โ
falcon.py
Provides Falcon1024 signature generation and verification. Optimized for constrained environments and used in peer authentication.
โ
guardian.py
Core module for node validation and distributed trust. Handles peer audits, identity signing, entropy scoring, and latency-based selection.
โ
__init__.py
Exposes the public API of pqbit. Centralizes imports, versioning, and module registration for PyPI and internal use.
โ
kyber.py
Handles Kyber1024 key encapsulation and decapsulation. Used for encrypted broadcast, peer discovery, and secure tunnel initialization.
โ
log_benchmark.py
Captures structured logs from benchmarking modules. Supports JSON output, timestamping, and integration with external log viewers.
โ
log_viewer.py
Interactive CLI or GUI tool for visualizing logs. Displays entropy trends, latency spikes, and authentication events in real time.
โ
mesh.yaml
Declarative configuration file for mesh topology. Defines peers, routes, namespaces, and tunnel parameters for WireGuard orchestration.
โ
obfs4.py
Wraps obfs4proxy for traffic cloaking. Supports certificate pinning, port randomization, and stealth routing for anonymous overlays.
โ
pqclean.py
Provides low-level bindings to PQClean C implementations via ctypes. Enables direct access to Kyber, Falcon, and Dilithium primitives.
โ
pysocks.py
Sets up SOCKS proxies for flexible routing. Integrates with WireGuard and Obfs4 to support layered anonymity and traffic redirection.
โ
report.py
Generates audit reports from peer validation and guardian logs. Summarizes trust scores, signature integrity, and routing performance.
โ
tunnel.py
Manages WireGuard tunnel lifecycle. Validates configs, applies namespaces, and monitors tunnel health across mesh nodes.
โ
verifier.py
Verifies digital signatures and peer identities. Used during handshake, broadcast validation, and audit replay.
โ
wg-meshconf.py
Generates WireGuard configuration files from mesh.yaml. Supports multi-peer setups, namespace isolation, and adaptive routing hints.
โ
wireguard.py
Low-level interface to WireGuard. Handles key generation, tunnel setup, peer registration, and config synchronization.
โ
wireshark.py
Captures and analyzes packets using PyShark and Scapy. Tracks entropy, latency, and cloaking effectiveness across mesh traffic.
โ
wallet.py
Generates offline post-quantum wallets using 36-word seed phrases. Hashes seed with SHA3-512, signs digest with Dilithium5, and outputs a verifiable identity fingerprint. Includes signature verification logic for integrity checks.
๐ Table of Contents
๐ Project Overview
pqbit is a modular Python library for building secure, decentralized, and post-quantum digital infrastructure. It combines cryptographic primitives, mesh networking, traffic cloaking, and offline identity generation into a unified toolkit designed for resilience and autonomy.
Built for researchers, engineers, and privacy advocates, pqbit empowers users to:
- ๐ Generate and verify post-quantum keys and signatures using Kyber, Dilithium, and Falcon
- ๐ธ๏ธ Deploy adaptive WireGuard mesh networks with entropy-based routing and namespace isolation
- ๐ฐ๏ธ Broadcast encrypted discovery messages across cloaked overlays using Obfs4 and PySocks
- ๐ Create offline wallets with SHA3-512 fingerprints and Dilithium-signed seed phrases
- ๐ Monitor traffic entropy, latency, and peer trust in real time via PyShark and Scapy
Whether you're prototyping quantum-safe VPNs, auditing peer identities, or building sovereign mesh systems, pqbit gives you full control over every cryptographic and network layer โ with zero reliance on centralized infrastructure.
๐ฆ Objective
To offer a lightweight, auditable, and ready-to-use library for integrating quantum security with decentralized networks like Bit512.
Inspired by the PQClean project and integrated with anonymity technologies like Obfs4, WireGuard, and PySocks.
๐ Supported Algorithms and Technologies
๐ pqbit/simulation.py
๐ pqbit/wallet.py
โ
Integrated with __init__.py, test_repository.py, and wallet.py
๐ง Simulates key generation, encapsulation, signing, and verification using secrets.token_bytes() and 36-word seed phrases
- Kyber1024 โ Quantum-resistant key encapsulation (KEM)
- Dilithium5 โ High-security post-quantum digital signatures (used in wallet signing)
- Falcon1024 โ Compact and efficient signatures for constrained environments
- SHA3-512 โ Cryptographic hashing for seed digest and public key fingerprinting
- Obfs4 โ Traffic cloaking for anonymous networks
- WireGuard โ Lightweight and secure VPN tunneling
- PySocks โ SOCKS proxy for flexible traffic routing
- PQClean โ Clean C implementations for post-quantum cryptography
- Wireshark (via PyShark) โ Deep packet inspection and live traffic analysis
๐ค Contributing
Contributions are welcome! Fork the repository, open issues, and submit pull requests to help evolve Bit512.
๐ License
This project is licensed under the MIT License โ see the LICENSE file for details.
๐ Gratitude
Inspired by PQClean and dedicated to the open-source security community.
This project is dedicated to the Python community and to those who believe in digital freedom.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 pqbit-1.2.0.tar.gz.
File metadata
- Download URL: pqbit-1.2.0.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
134e9266f9977736b8a01519ccf344dead3bd60847a1277e39026c04d4e3de97
|
|
| MD5 |
b68978272d467b6229436df84851cbd4
|
|
| BLAKE2b-256 |
b3d62d1c6dce25231f152be94398adeda48a34b836f5a68e6326b2b7c0d1b055
|
File details
Details for the file pqbit-1.2.0-py3-none-any.whl.
File metadata
- Download URL: pqbit-1.2.0-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da32cdfcba7859f2a0dd32ac0fd989ccf8338c53fdf4980198d8da36938ff010
|
|
| MD5 |
9f76661005b1a4f93c1ce6e08ae13ed8
|
|
| BLAKE2b-256 |
3b1601a7e5477616b1989305790e7ab2b2faa5fa10b7f15fc6ba6845e9a65493
|