Inspiration

Inspiration for this particular project came from two main sources. The first was the fact that I am currently taking CMSC417: Computer Networks. My head is filled to the brim with computer networks nonsense, so it makes sense that I gravitated towards a project that built off of that knowledge. The rest of the idea came from looking over my Quantum Computing notes. I remembered that Quantum key distribution meshed incredibly well with the Computer Networks. And thus this project was born. The specific details like BB84 and such were worked out later.


What it does

QuantumGuard is essentially a simulator. It is an interactive simulator that demonstrates how the BB84 QKD (Quantum Key Distribution) protocol detects eavesdropping. It has three parts. A sender, a receiver, and an intruder are used to show how interception works in classical vs. quantum systems. Through various visualizations, users can observe how secure communication acts when under attack.


How I built it

The project is a full-stack web application. The frontend uses React and Vite to build an interactive interface with visualizations. The backend is built with FastAPI, WebSockets, and various quantum simulations using probabilities and IBM's Qiskit, used to model real Quantum Qubits.

I implemented a classical simulation of the BB84 protocol, modeling qubit transmission.

BB84 Protocol — Qubit Representation

Qubit States

A qubit is represented as a superposition:

$$ |\psi\rangle = \alpha |0\rangle + \beta |1\rangle $$

where

$$ |\alpha|^2 + |\beta|^2 = 1 $$

Encoding (Alice)

Alice chooses:

  • Bit $$ b \in {0,1} $$
  • Basis $$ \theta \in {Z, X} $$

Encoding:

$$ \text{If } \theta = Z: \begin{cases} b = 0 \rightarrow |0\rangle \ b = 1 \rightarrow |1\rangle \end{cases} $$

$$ \text{If } \theta = X: \begin{cases} b = 0 \rightarrow |+\rangle \ b = 1 \rightarrow |-\rangle \end{cases} $$


Measurement (Bob)

Bob randomly chooses basis $$\theta'$$

If $$ \theta' = \theta $$ $$ \text{Measurement is correct with probability } 1 $$

If $$ \theta' \ne \theta $$ $$ P(0) = P(1) = \frac{1}{2} $$


Basis Matching (Sifting)

Keep bits where: $$ \theta = \theta' $$

Discard others.


Eavesdropping (Eve)

Eve measures in random basis $$ \theta_E $$

  • If $$ \theta_E \ne \theta $$
    • State collapses incorrectly
    • Introduces detectable errors

The system then computes the Quantum Bit Error Rate (QBER), defined as:

$$ QBER = \frac{\text{number of mismatched bits}}{\text{total compared bits}} $$

This value is used to determine whether an intruder has interfered with the communication. If the threshold is about 11%, it discards the key and restarts.

The flow is: Origin --> Server (Build Qubit) (Measure) --> Intruder (To simulate a network) --> Server (if measured to modify) --> Target (The receiver)

The front end, mostly React, was developed through agile iteration building. Various agents were used together to maximize efficiency at the front end. The back end, especially the quantum segments, was written mostly by hand or with some Agentic assistance.


Challenges I ran into

One of the biggest challenges was figuring out how exactly I could fit quantum computing into the system. True sending to IBM's backend would not only be costly and difficult but also require immense time and cause delays. However, over-reliance on simple classical calculations risked eliminating the quantum influence of the project. Thus, a balance was found eventually.

The other most difficult part was dealing with WebSockets. It was my first time handling WebSockets, and I relied on various online resources, AI Assistance, and even then, there were significant bugs that required hours to slowly work out.


Accomplishments that I'm proud of

I'm most proud of the networking protocol. Specifically, integrating quantum computing with this networking protocol was the most challenging part of the project, because it was difficult to figure out how to do so without compromising authenticity. I figured it out eventually, and after that it wasn't bad, it took 4 iterations of different techniques (like trying to send over qubits directly, which were incompatible with WebSockets), and an attempt to switch languages to Rust (ended in failure. Too complex).

I also successfully deployed the project as a live web application, allowing anyone to access and run the simulation without installing anything locally.


What I learned

My two greatest gains out of this project were learning more about WebSockets and getting a bit more familiar with them, and the things I learned in Quantum Computing as I attempted to complete this project.

Built With

Share this project:

Updates