qcrypt-rng / docs /PROJECT_OVERVIEW.md
rocRevyAreGoals15's picture
fixing ui
86deab0

QCrypt RNG β€” Project Overview

A high-level explanation of what QCrypt RNG is, what it does, and how it is built.


What Is QCrypt RNG?

QCrypt RNG is a platform for quantum-enhanced randomness and post-quantum cryptography. It exposes a REST API and web UI for:

  • Generating cryptographically secure random data using quantum-style entropy
  • Running NIST-standard post-quantum algorithms (signatures and key exchange)
  • Providing a verifiable random function (VRF) for blockchains
  • Encrypting and protecting data with quantum-derived keys

It is intended for developers, researchers, and teams building quantum-resistant or blockchain-facing applications.


Core Capabilities

1. Quantum Random Number Generation (QRNG)

  • Random bytes β€” Configurable length and qubit count (8/12/16)
  • Keys β€” AES, RSA, ECDSA keys with quantum entropy
  • UUIDs β€” RFC 4122 v4 UUIDs
  • Passwords β€” Configurable length and character sets
  • Session tokens β€” URL-safe, with optional expiry
  • Batch mode β€” Multiple samples in parallel

How it works: The system uses a pluggable backend (simulation, Qrisp, or real hardware). Random values are obtained from a hardware abstraction layer, post-processed with SHA3-256, and mixed with system entropy. Results are stored in an entropy pool for quality checks (Shannon entropy, min-entropy, chi-square).


2. Post-Quantum Cryptography (PQC)

Supports NIST-standard algorithms via liboqs (with fallbacks when liboqs is not available).

Signature schemes:

  • DILITHIUM β€” Level 2, 3, 5
  • FALCON β€” 512 / 1024
  • SPHINCS+ β€” Hash-based variant (e.g., SHA2-128f)

Key encapsulation (KEM):

  • Kyber β€” 512 / 768 / 1024
  • NTRU-HPS β€” 2048-509, 2048-677
  • SABER β€” LIGHTSABER, SABER, FIRESABER

The Kyber KEM flow includes:

  1. Recipient generates a keypair
  2. Sender encapsulates a shared secret with the recipient’s public key
  3. Recipient decapsulates with their private key
  4. Both derive the same shared secret for symmetric cryptography

3. Quantum VRF (Verifiable Random Function)

A VRF backed by quantum entropy with a commit–reveal flow:

  1. Seed β€” 32-byte quantum seed is generated and committed via Keccak-256
  2. Prove β€” For any input (alpha), output = Keccak256(seed || alpha)
  3. Reveal β€” Seed is revealed so anyone can verify
  4. Verify β€” Checks that commitment and output match the seed and alpha

The Keccak-256 format is compatible with Ethereum/Solidity.


4. On-Chain Oracle Fulfillment

Supports submit-and-fulfill oracle randomness on blockchains:

  • Chains: Ethereum, Polygon, BSC, Avalanche, Fantom
  • Flow: Configure chain (RPC, private key, explorer), create request, commit on-chain, reveal randomness
  • Status: Track PENDING β†’ COMMIT_SUBMITTED β†’ REVEAL_CONFIRMED β†’ COMPLETED
  • Retry: Retry failed fulfillments

5. Data Protection

  • Encryption β€” AES-256-GCM, AES-128-GCM, AES-256-CBC (quantum or user keys)
  • File encryption β€” Up to 10 MB
  • Signing β€” HMAC-SHA256, HMAC-SHA512
  • Hashing β€” SHA3-256, SHA3-512, PBKDF2-SHA256, BLAKE2b-256
  • Salt β€” Quantum-generated salts for hashing

6. Blockchain Security Tools

  • Wallet creation β€” Compare classical (ECDSA) vs quantum-safe (DILITHIUM/KYBER) wallets
  • Attack simulation β€” Simulate Shor’s algorithm on RSA, ECDSA, DILITHIUM, KYBER
  • Blockchain comparison β€” Side-by-side vulnerable vs quantum-safe chain models
  • Demo mining β€” Proof-of-work-style mining for both types

7. Threat Intelligence

  • Algorithm assessment β€” β€œQubits to break” and migration guidance for RSA, ECDSA, etc.
  • Oracle benchmark β€” Latency and throughput
  • Entropy quality β€” Shannon entropy, min-entropy, chi-square, autocorrelation

8. Quantum Hardware Abstraction

Pluggable backends for different sources:

  • Simulation β€” Classical fallback for dev/demo
  • Qrisp β€” Quantum simulation when available
  • ID Quantique Quantis β€” Photonic QRNG (USB, PCIe, network)
  • QuintessenceLabs qStream β€” Photonic QRNG over TCP/IP

Includes entropy quality checks (NIST SP 800-90B–style analysis).


Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Next.js Dashboard (quantum-oracle-ui)                       β”‚
β”‚  Port 3000 (dev) / served by Nginx (prod)                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  FastAPI Backend (app/)                                      β”‚
β”‚  Port 8000 | Base path: /api/v2                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Endpoints:                                                  β”‚
β”‚  - /generate/*    Quantum RNG                                β”‚
β”‚  - /protect/*     Encryption, signing, hashing               β”‚
β”‚  - /pqc/*         Post-quantum crypto (incl. KEM)            β”‚
β”‚  - /oracle/*      VRF, oracle requests, fulfillment         β”‚
β”‚  - /blockchain/*  Wallets, attack sim, mining                β”‚
β”‚  - /quantum/*     Entropy, stats, reseed                     β”‚
β”‚  - /hardware/*    Device list, benchmark, connect            β”‚
β”‚  - /monitoring/*  Metrics, analytics                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Core Modules (app/quantum/, app/blockchain/)                β”‚
β”‚  - qrng.py            Quantum RNG engine                     β”‚
β”‚  - commitment.py      Keccak-256 commitments                 β”‚
β”‚  - pqc.py             liboqs PQC (Dilithium, Kyber, etc.)    β”‚
β”‚  - hardware_interface β”‚ Photonic, superconducting, simulated β”‚
β”‚  - oracle_service.py  On-chain fulfillment                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

Layer Technology
Backend Python 3.8+, FastAPI, Uvicorn
Frontend Next.js 16, React, TypeScript, Tailwind CSS
Quantum Qrisp (optional), custom hardware abstraction
Crypto PyCryptodome (Keccak), cryptography, liboqs
Deployment Docker (single image), Compose, Kubernetes
Monitoring Prometheus metrics, analytics service

Project Layout

qcrypt-rng/
β”œβ”€β”€ app/                    # FastAPI backend
β”‚   β”œβ”€β”€ api/v2/endpoints/   # REST routes
β”‚   β”œβ”€β”€ quantum/            # QRNG, PQC, commitment, hardware
β”‚   β”œβ”€β”€ blockchain/         # Chain adapters, oracle service
β”‚   β”œβ”€β”€ utils/              # Logging, monitoring, middleware
β”‚   └── config.py
β”œβ”€β”€ quantum-oracle-ui/      # Next.js dashboard
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ unit/               # Pytest unit tests
β”‚   β”œβ”€β”€ integration/        # Pytest integration tests
β”‚   └── manual/             # Standalone scripts (not collected by pytest)
β”œβ”€β”€ docs/                   # PRODUCTION, guides, business, archive, roadmaps
β”œβ”€β”€ examples/               # Standalone sample scripts
β”œβ”€β”€ legacy/                 # Streamlit + static HTML (deprecated UI path)
β”œβ”€β”€ scripts/                # e.g. start.py (API + Next.js for dev)
β”œβ”€β”€ quantum-oracle/         # Oracle node, contracts, SDKs
β”œβ”€β”€ client_sdk/python/      # Python client library
β”œβ”€β”€ k8s/                    # Kubernetes manifests
β”œβ”€β”€ run_api.py              # Start API server only
β”œβ”€β”€ requirements.txt
└── Dockerfile              # Single image for production

Running the Project

Backend:

pip install -r requirements.txt
python run_api.py

β†’ API at http://localhost:8000, docs at http://localhost:8000/docs

Dashboard:

cd quantum-oracle-ui && npm install && npm run dev

β†’ Dashboard at http://localhost:3000 (uses API on 8000–8004 by default)

Production: docker-compose up -d or ./deploy.sh (Kubernetes)

Hugging Face Spaces: Use root Dockerfile for a Docker Space on port 7860.


Security Notes

  • Simulation and classical fallback are for development/demo only.
  • Use a validated QRNG or trusted HRNG in production.
  • VRF seeds are kept in memory; consider hardened storage for high assurance.
  • Private keys for on-chain fulfillment must be stored and handled securely (no production keys in demos).
  • Enable rate limiting and API key auth in production.

Related Documents


Last updated: 2026-03-06