Quantum Key Distribution (QKD)

CS 463/480 Lecture, Dr. Lawlor

Folks are using quantum key distribution to protect their data using physics instead of math.

class photon {
	// true polarization state:
	//   0 vertical
	//   1 diagonal up
	//   2 horizontal
	//   3 diagonal down
	unsigned int polarization; 
	photon() {

	/* Return true if this photon is detected at this polarization filter angle.
	   This method is not const, due to observation's effect on the particle. */	
	bool detect(unsigned int angle) {
		while (true) {
			if (polarization==angle)
				return true; // yup
			else if ((polarization+2)%4==angle)	
				return false; // nope--cross polarized	
			// else randomly project polarization onto angle

void run_test(bool with_eve) {
	int agree_angle=0, agree_detect=0;
	for (int test=0;test<1000000;test++) {
		photon p; // generated by alice
		int alice_angle=rand()%4;
		bool alice_detect=p.detect(alice_angle);

		if (with_eve) {
		int bob_angle=rand()%4;
		bool bob_detect=p.detect(bob_angle);
		if (alice_angle == bob_angle) {
			if (alice_detect == bob_detect) agree_detect++;
	std::cout<<"Bob and alice's filter angles agreed "<<agree_angle<<" times, and photons agreed "<<agree_detect<<" times\n";

void foo() {

(Try this in NetRun now!)

The weird part about this is Alice and Bob can detect Eve's effect on the polarization of the photon no matter *how* Eve measures the polarization. 

Without Eve, Bob and Alice's filter angles agreed 250115 times, and photons agreed 250115 times.
With Eve, Bob and Alice's filter angles agreed 249833 times, and photons agreed 187838 times.

Even if Eve uses a fancy beam splitter to make two copies of the photon, sends one copy through unmodified, and only later measures her local copy, entanglement means we can still detect this operation!

There are some definite drawbacks: