Introduction
The goal of this assignment was to simulate symmetric Quantum Key Encryption. We did this by creating a Qubit class and using that to generate the key that is to be used in the XOR class we create. This will allow us to pass messages without exposing their content to the outside world. I decided to do this in Java as it is what I have the most experience in.
Qubit Class
This part of the assignment was quite simple as we were given a UML diagram for the class and were able to simply create the class based on that. It is a simple object that allows for the storage of a value and a polarisation. There is also a measure method that returns the value if the polarisation matches else it generates a new random polarisation and then returns the value.
XOR Class
This was just a simple matter of applying an XOR operation to the message using the key repeated to the end of the message.
The Encryption Algorithm
I decided to break this down into three parts. A transmitter class, a receiver class, and the main method. The transmitter creates a random stream of bytes. Then the receiver takes that stream of qubits and using random polarisation generates its stream of qubits using the values from the transmitter’s random polarisation. Then the transmitter passes back the new qubits and each generates its key. Both keys should match. Then the main method performs the XOR encryption and decryption.
Testing
I wrote a few simple unit tests throughout the creation of this project using jUnit. These helped me to ensure all parts of the software were working as I intended and allowed me to better identify issues and bugs I found while creating software.
Conclusion
This project was quite fun and it was interesting to learn about some of the lesser-known parts of computer science such as Quantum Computing and Encyrption. I learned a lot and look forward to studying some parts of this a bit further.