Post-quantum mesh VPN library with offline wallet generation via Falcon-1024, Dilithium5 and SHA3-512
Project description
๐ง pqbit
pqbit library with post-quantum mesh VPN using WireGuard, PQClean, Pyshark, Scapy, Logging4, digital wallet with (Dilithium5 and SHA3-512) and integrated CLI โ developed for Bit512.
๐ฆ Objective
To help build the blockchain of the next millennium. To offer a lightweight, auditable, and ready-to-use library, integrating post-quantum security and anonymity technologies such as Obfs4, WireGuard, and PySocks, with decentralized networks like Bit512. You can also experiment with and use pqbit in your projects to increase the level of security. This is an open-source project. It's free.
๐ค Contributing
All contributions are welcome! Fork the repository, open issues, and submit pull requests to help develop Bit512. For major changes, please open an issue to discuss your idea and what you would like to change to improve the library.
๐ License
This project is licensed under the MIT License โ see the LICENSE file for details.
๐ Gratitude
Inspired by PQClean and dedicated to the community that values โโsecurity and open source. I dedicate this pqbit project to the entire Python community and those who believe in digital freedom.
Version 1.3.1
Falcon-1024 powered wallet generator, signer and verifier โ built for post-quantum cryptography.
Author: Kito Hamachi โ Bit512 Labs
License: MIT
Repository: github.com/kitohamachi/pqbit
PyPI: pypi.org/project/pqbit
๐ฆ Installation
Install via PyPI:
pip install pqbit
Or clone the repository:
git clone https://github.com/kitohamachi/pqbit.git
cd pqbit
pip install -r requirements.txt
๐งช Usage Examples
โ ๏ธ Falcon Patent Notice and ๐ License
MIT License.
This project uses the Falcon-1024 cryptosystem.
Falcon cryptosystem may be subject to additional patent restrictions.
According to NIST IP statements, Falcon may be covered by patent US7308097B2.
Use at your own risk. This is not legal advice.
๐ 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
from pqbit import generate_wallet, verify_wallet
from pqbit.wallet import generate
wallet = generate()
print(wallet)
wallet = generate_wallet()
print("Fingerprint:", wallet["public_key"])
print("Verified:", verify_wallet(wallet))
Explore more examples in the project documentation.
๐ ๏ธ CLI Usage
pqbit generate # Generate a new wallet
pqbit verify wallet.json # Verify wallet integrity
pqbit sign message.txt # Sign a message using wallet.json
pqbit inspect wallet.json # Show wallet details
pqbit export --format pem # Export keys in PEM format
pqbit batch-sign *.txt # Sign multiple files
pqbit qr wallet.json # Generate QR code from wallet
pqbit yaml wallet.json # Convert wallet to YAML
๐ฆ Python API
from pqbit.wallet import generate, verify_wallet, sign_message, verify_signature
wallet = generate()
assert verify_wallet(wallet)
msg = b"hello world"
sig = sign_message(msg, bytes.fromhex(wallet["private_key"]))
assert verify_signature(msg, sig, bytes.fromhex(wallet["raw_public_key"]))
โ Running Tests
pytest tests/
๐ Running Benchmarks
python benchmarks/benchmark_wallet.py
๐งช Test Coverage
- โ Wallet generation
- โ Signature verification
- โ Message signing
- โ Batch signing
- โ QR code export
- โ YAML/JSON export
- โ PEM export
๐ฆ Output Example
{
"public_key": "f3a1...9c",
"raw_public_key": "04ab...ff",
"digest": "e9d1...2a",
"signature": "30b2...cd",
"private_key": "9f8e...01"
}
<p align="center">
<img src="assets/banner.png" alt="pqbit โ Post-Quantum Wallet" width="600"/>
</p>
<h1 align="center">pqbit</h1>
<p align="center">
<strong>Post-Quantum Offline Wallet</strong><br>
<em>Dilithium5 Signatures ยท SHA3-512 Integrity ยท Built for Bit512</em>
</p>
<p align="center">
<a href="https://pypi.org/project/pqbit/"><img src="https://img.shields.io/pypi/v/pqbit?color=blue&label=PyPI" alt="PyPI Version"></a>
<a href="https://github.com/kitohamachi/pqbit/blob/main/LICENSE"><img src="https://img.shields.io/github/license/kitohamachi/pqbit?color=green" alt="License"></a>
<a href="https://github.com/kitohamachi/pqbit/issues"><img src="https://img.shields.io/github/issues/kitohamachi/pqbit?color=orange" alt="Issues"></a>
<a href="https://github.com/kitohamachi/pqbit/stargazers"><img src="https://img.shields.io/github/stars/kitohamachi/pqbit?color=yellow" alt="Stars"></a>
</p>
---
## ๐ Table of Contents
- [๐ Features](#-features)
- [๐ฆ Installation](#-installation)
- [๐งช Usage](#-usage)
- [๐ Security](#-security)
- [๐งญ Roadmap](#-roadmap)
- [๐ License](#-license)
- [๐ค Contributing](#-contributing)
- [๐ Related Projects](#-related-projects)
---
## ๐ Features
- ๐ Offline wallet generation using post-quantum cryptography
- ๐งฌ Dilithium5 digital signatures for quantum-safe authentication
- ๐ SHA3-512 hashing for data integrity
- ๐ Mesh VPN integration with WireGuard
- ๐ง Compatible with [PQClean](https://github.com/pqclean/pqclean), [Pyshark](https://github.com/KimiNewt/pyshark), [Scapy](https://github.com/secdev/scapy), and Logging4
- ๐ฆ Designed for [Bit512](https://github.com/kitohamachi/bit512) โ the currency of the next millennium
---
## ๐ 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
---
## ๐งฉ 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.
---
## ๐ Supported Algorithms and Technologies
๐ง 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
---
## ๐ 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.
### โ
`cli.py`
Command-line interface for pqbit operations. Handles wallet generation, verification, signing, and various export formats including QR codes and YAML.
### โ
`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.
### โ
`simulation.py`
Provides simulation capabilities for testing cryptographic operations and network scenarios in controlled environments.
### โ
`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.
### โ
`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.
### โ
`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.
---
## ๐ Table of Contents
- [๐ง pqbit](#-pqbit)
- [๐ฆ Objective](#-objective)
- [๐ค Contributing](#-contributing)
- [๐ License](#-license)
- [๐ Gratitude](#-gratitude)
- [๐ฆ Installation](#-installation)
- [๐งช Usage Examples](#-usage-examples)
- [๐ ๏ธ CLI Usage](#๏ธ-cli-usage)
- [๐ฆ Python API](#-python-api)
- [โ
Running Tests](#-running-tests)
- [๐ Running Benchmarks](#-running-benchmarks)
- [๐งช Test Coverage](#-test-coverage)
- [๐ฆ Output Example](#-output-example)
- [๐ Features](#-features)
- [๐ Features](#-features-1)
- [๐งฉ Key Components](#-key-components)
- [๐ Supported Algorithms and Technologies](#-supported-algorithms-and-technologies)
- [๐ Modules Overview](#-modules-overview)
- [๐ Project Overview](#-project-overview)
- [๐ Security](#-security)
- [๐งญ Roadmap](#-roadmap)
- [๐ Related Projects](#-related-projects)
---
## ๐ 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.
---
## ๐ Security
**Dilithium5** is a lattice-based digital signature scheme selected by [NIST](https://csrc.nist.gov/projects/post-quantum-cryptography) for post-quantum cryptography. It offers strong resistance against quantum attacks while remaining efficient for real-world use.
**SHA3-512** is part of the Keccak family, providing robust hashing with high collision resistance and integrity guarantees.
Together, they ensure that `pqbit` remains secure even in a future with quantum computing.
---
## ๐งญ Roadmap
- โ
Offline wallet generation (Dilithium5 + SHA3-512)
- ๐ Integration with [Bit512](https://github.com/kitohamachi/bit512)
- ๐งช Falcon signature support (experimental)
- ๐ก Decentralized mesh VPN node deployment
- ๐ฑ Mobile wallet interface (planned)
- ๐ Benchmarking and performance suite
---
## ๐ Related Projects
- [Bit512](https://github.com/kitohamachi/bit512)
- [PQClean](https://github.com/pqclean/pqclean)
- [WireGuard](https://www.wireguard.com/)
- [Pyshark](https://github.com/KimiNewt/pyshark)
- [Scapy](https://github.com/secdev/scapy)
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.3.1.tar.gz.
File metadata
- Download URL: pqbit-1.3.1.tar.gz
- Upload date:
- Size: 30.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
142d9b3a47967df8eb27d0962cd837636e7931d3011d6270cff98f14e72e5c55
|
|
| MD5 |
fb1c664f3ffe783c4651ddfa137dee25
|
|
| BLAKE2b-256 |
47776634792a46810a79e9eb955fe041694e7a6411369cfbcd99970c1f8175ca
|
File details
Details for the file pqbit-1.3.1-py3-none-any.whl.
File metadata
- Download URL: pqbit-1.3.1-py3-none-any.whl
- Upload date:
- Size: 30.9 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 |
8cc3fcb59cad8c770401a9616ad8c0e18d3764016a1cf587711544ad46df261b
|
|
| MD5 |
17ff5d4a36b826d58e98d1235d432d9d
|
|
| BLAKE2b-256 |
1f6db9393900f5649e43369b3373e245b987ac1026f2978fed469c32c8bd1b70
|