Skip to main content

Post-quantum mesh VPN library with offline wallet generation via Falcon-1024, Dilithium5 and SHA3-512

Project description

๐Ÿง  pqbit

Banner pqbit v1.3.1 PyPI License Build Coverage

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

pqbit-1.3.1.tar.gz (30.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pqbit-1.3.1-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

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

Hashes for pqbit-1.3.1.tar.gz
Algorithm Hash digest
SHA256 142d9b3a47967df8eb27d0962cd837636e7931d3011d6270cff98f14e72e5c55
MD5 fb1c664f3ffe783c4651ddfa137dee25
BLAKE2b-256 47776634792a46810a79e9eb955fe041694e7a6411369cfbcd99970c1f8175ca

See more details on using hashes here.

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

Hashes for pqbit-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8cc3fcb59cad8c770401a9616ad8c0e18d3764016a1cf587711544ad46df261b
MD5 17ff5d4a36b826d58e98d1235d432d9d
BLAKE2b-256 1f6db9393900f5649e43369b3373e245b987ac1026f2978fed469c32c8bd1b70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page