Skip to main content

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

Project description

๐Ÿง  pqbit

PyPI License Build Coverage

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

pqbit-1.2.0.tar.gz (25.2 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.2.0-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

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

Hashes for pqbit-1.2.0.tar.gz
Algorithm Hash digest
SHA256 134e9266f9977736b8a01519ccf344dead3bd60847a1277e39026c04d4e3de97
MD5 b68978272d467b6229436df84851cbd4
BLAKE2b-256 b3d62d1c6dce25231f152be94398adeda48a34b836f5a68e6326b2b7c0d1b055

See more details on using hashes here.

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

Hashes for pqbit-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da32cdfcba7859f2a0dd32ac0fd989ccf8338c53fdf4980198d8da36938ff010
MD5 9f76661005b1a4f93c1ce6e08ae13ed8
BLAKE2b-256 3b1601a7e5477616b1989305790e7ab2b2faa5fa10b7f15fc6ba6845e9a65493

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