An interactive, single-page pedagogical instrument designed to simulate, visualize, and verify the Ekert91 (E91) Quantum Key Distribution (QKD) protocol. This simulator models the deep relationship between quantum non-locality (via CHSH inequality violations) and cryptographic security bounds.
This project is entirely self-contained within a single index.html file with no external compile steps or heavy NPM dependencies. You can spin it up locally using any standard static file server.
Make sure you have Python (or Node.js) installed on your system.
- Clone or download this repository to your local machine:
git clone https://github.com/your-username/E-91-Simulator.git cd E-91-Simulator - Fire up the local web server using Python's built-in module:
python -m http.server 8000
- Open your preferred web browser and navigate to the application:
http://localhost:8000
The core simulation engine mathematically models a centralized source emitting maximally entangled Einstein-Pedolsky-Rosen (EPR) photon pairs in the symmetric Bell state:
To bridge real-world laboratory setups with quantum mechanical probability matrices, physical polarizer display angles (
-
Alice's Set (
$\theta_A$ ):$0, \frac{\pi}{8}, \frac{\pi}{4}$ (corresponding to display angles$0^\circ, 45^\circ, 90^\circ$ ) -
Bob's Set (
$\theta_B$ ):$\frac{\pi}{8}, \frac{\pi}{4}, \frac{3\pi}{8}$ (corresponding to display angles$45^\circ, 90^\circ, 135^\circ$ )
For mismatched testing bases, individual correlation coefficients
The aggregate CHSH inequality index
The simulator accurately maps out the operational divergence between a secure quantum channel and one under a malicious intercept-resend attack:
| Metric Parameter | Authentic Channel (Eve Inactive) | Intercept-Resend Attack (Eve Active) |
|---|---|---|
| Quantum Waveform | Coherent, stable green sinusoids | Collapsed, fragmented red indicators |
| CHSH Index ( |
|
|
| Key Agreement Status | Secure channel verified; keys match perfectly | Protocol aborted; data stream compromised |
| Key Basis QBER | 0.00% |
|
-
Control Console: Fine-tune experimental parameters including total photon pair volume (
$N \in [10, 200]$ ), execution intervals, and toggle switches for live eavesdropping interception. - Quantum Channel Visualizer: An interactive HTML5 Canvas that renders real-time wave functions, polarization indicators on flying photons, and dynamic polarizer dial rotations.
-
Telemetry Panel: Instantly audits statistical variables including the Quantum Bit Error Rate (QBER), live tracking of the
$S$ -parameter, and channel safety ratings. - Protocol Ledger: A reverse-chronological streaming row component displaying basis assignments, raw outputs, allocation pathways (Key Gen vs. CHSH Test), and sifting status flags.
This dashboard acts as an omniscient administrative HUD. In a real physical deployment, Alice's and Bob's local registers are isolated to preserve confidentiality. This view intentionally links them side-by-side on one screen to allow faculty inspectors to easily audit the software's structural integrity, the performance of the sifting loops, and the convergence of statistical variance under the Law of Large Numbers.