Quantum-powered
Randomised Password Generator
From Pseudo to Quantum Randomness
Traditional pseudo-random number generators (PRNGs) rely on deterministic algorithms and seeds. True random number generators (TRNGs) use physical noise, while quantum random number generators (QRNGs) exploit fundamental unpredictability of quantum mechanics for irreducible randomness.
Cryptographic Need for Secure Randomness
- Unpredictability: Bits should be impossible to guess.
- Uniformity: Equal chance for 0 and 1.
- Forward/backward secrecy: Compromise of some outputs shouldn’t reveal others.
- Performance: Must generate bits fast enough.
- Auditability: Verifiable against bias or hidden channels.
Weakness of PRNGs
Even cryptographically secure PRNGs (CSPRNGs) still depend on seeds. Weak entropy sources can lead to repeated keys or predictable outputs, breaking security.
Quantum Mechanics: Source of Randomness
Quantum measurement outcomes are inherently probabilistic. Example: a qubit state ∣ψ⟩ = α|0⟩ + β|1⟩ collapses to 0 or 1 with probabilities |α|² and |β|². With a Hadamard gate (H), starting from |0⟩, we get:
H|0⟩ → (|0⟩ + |1⟩)/√2, giving a 50/50 chance of 0 or 1.
QRNG Hardware Examples
Physical QRNG devices use photon splitting, vacuum fluctuations, or electron tunneling. Example: ANU QRNG generates live random bits from quantum vacuum fluctuations.
Step-by-Step Workflow
- Initialize qubit in |0⟩.
- Apply Hadamard (H) gate → superposition.
- Measure → collapse into 0 or 1 with equal probability.
- Repeat many times to form bitstrings.
- Convert groups of bits into integers.
- Map integers to alphanumeric/symbol characters.
- Concatenate into a password string.
Qiskit Implementation
from qiskit import QuantumCircuit, execute, Aer
def quantum_bit():
qc = QuantumCircuit(1,1)
qc.h(0) # Hadamard gate
qc.measure(0,0) # Measurement
backend = Aer.get_backend('qasm_simulator')
job = execute(qc, backend, shots=1)
result = job.result()
bit = int(list(result.get_counts().keys())[0])
return bitRepeating this function gives random bits, which can be combined into secure passwords.
Why Quantum-Based Randomness Matters
- Resistant against future quantum attacks on cryptography.
- Meets strict security certifications (e.g., defense, finance).
- Provides entropy for IoT/embedded devices with limited noise sources.
- Backed by quantum standards and audits for high confidence.
- Enables advanced protocols like Quantum Key Distribution (QKD).
Educational Value
Demonstrating quantum randomness with tools like Qiskit makes abstract quantum ideas tangible. Your project illustrates how a “normal” looking password (e.g. p9#dL7yZ!) can be rooted in the irreducible uncertainty of quantum mechanics.
Further Reading
- Random number generation
- Pseudorandom number generator
- Quantum random number generator
- Hardware random number generator
- Quantum key distribution
- Quantum random number generation (Review, arXiv)
- ANU QRNG (Live service)
- ID Quantique QRNG overview
- Qiskit documentation
♥ This project was a truly good learning experience, deepening my understanding of both cryptography and quantum computing. Looking forward to exploring more in this exciting intersection of fields! ♥
Click "Generate Password" to start