domingo, 22 de março de 2020

Quantum Games, Coins and Cybersecurity


The current blog post expands the previous two, linking quantum strategies and cybersecurity games. In this case, instead of two players as in the previous case, we have three players, Alice, Eve and Bob.

As we did in the previous blog post's game, let us also consider first the classical framework:

Alice and Bob are trying to communicate, through a classical communication channel, Eve is a hacker who is trying to attack the channel in order to disrupt the signals sent from Alice to Bob.

Since Alice and Bob are cooperating they form a coalition, Eve is playing against them. Alice is trying to send classical bits of information to Bob, Eve, as a hacker, is trying to corrupt the channel. Eve has the choice to hack the channel changing whatever bit was sent or not.

Alice and Bob know that Eve may have compromised the channel, so Bob must decide whether to change the data received or not, depending on what Eve may have done, something that Bob really does not know, he only knows that Eve may have hacked the channel and corrupted the transmission but he cannot be sure that she has done so.

It is important to stress that, in this scenario, with Alice and Bob's alternative strategies, it is not always advantageous for Eve to hack the channel.

Assuming that Alice has the bit "s" to send to Bob, we have the following scenarios:

1. Alice does not flip the bit, Eve hacks the channel, Bob does not flip the bit received, in this case, we have the sequence:

s->1-s->1-s: Alice and Bob lose (-1), Eve wins (+1)

2. Alice does not flip the bit, Eve hacks the channel, Bob flips the bit received, in this case, we have the sequence:

s->1-s->s: Alice and Bob win (+1), Eve loses (-1)

3. Alice flips the bit, Eve hacks the channel, Bob does not flip the bit received, in this case, we have the sequence:

1-s->s->s: Alice and Bob win (+1), Eve loses (-1) 

4. Alice flips the bit, Eve hacks the channel, Bob flips the bit received, in this case, we have the sequence:

1-s->s->1-s: Alice and Bob lose (-1), Eve wins (+1)

5. Alice does not flip the bit, Eve does not hack the channel, Bob does not flip the bit received, in this case, we have the sequence:

s->s->s: Alice and Bob win (+1), Eve loses (-1)

6. Alice does not flip the bit, Eve does not hack the channel, Bob flips the bit received, in this case, we have the sequence:

s->s->1-s: Alice and Bob lose (-1), Eve wins (+1)

7. Alice flips the bit, Eve does not hack the channel, Bob does not flip the bit received, in this case, we have the sequence:

1-s->1-s->1-s: Alice and Bob lose (-1), Eve wins (+1) 

8. Alice flips the bit, Eve does not hack the channel, Bob flips the bit received, in this case, we have the sequence:

1-s->1-s->s: Alice and Bob win (+1), Eve loses (-1)


We can see in the above scheme that, it is not always advantageous for Eve to hack the channel, indeed, when Alice flips the bit and Bob does not flip the bit or when Alice does not flip the bit and Bob flips the bit, it's better for Eve not to hack the channel, indeed, in this case, if Eve hacks the channel, Alice and Bob have erased the effect of Eve's hack, correcting the error introduced by Eve, so that Eve's best response is not to hack the channel, however, Eve has no way of knowing if Alice and Bob followed such a strategy.

Similarly, Alice and Bob never know if Eve has hacked the channel or not, they cannot know if their protocol is countering Eve's decision or not.

With the coalition in place we have the following game matrix:


Eve
Alice+Bob
Hack
No Hack
No flip, No flip
-1,+1
+1,-1
No flipFlip 
+1,-1
-1,1
Flip, No flip
+1,-1
-1,1
Flip, Flip
-1,+1
+1,-1


The game has no pure strategies Nash equilibrium and for Eve the optimal choice is to hack with 50% probability and not to hack with 50% probability. On the side of Alice+Bob, they must play with 50% probability a synchronized strategy (Flip/Flip, No flip/No flip) and with 50% probability a non-synchronized strategy (Flip/No flip, No flip/Flip).

Now, if Alice and Bob are, instead, using a quantum channel to communicate, then, they can play by a quantum strategy that is immune to Eve's mixed strategy attack. We show this in the following quantum circuit where Eve randomizes her move using a quantum coin.

To see how this is done, let us assume that Alice wants to send the bit "1" to Bob. The Open Quantum Assembly Language code for this game is presented below, the user just has to erase the line of code x q[0] to send a "0" instead of a "1".

The circuit for this code is:

In this case, Alice begins by flipping her quantum register to encode a "1", so that it is now |1> (this move by Alice would not be needed if she wanted to send a |0>), her  goal in the game is for Bob to receive s=1, to do this, instead of applying a classical strategy, she now implements a quantum move, applying the Haddamard transform which turns the quantum register's content into |->=(|0>-|1>)/sqrt(2), and sends this qubit through her quantum channel to Bob.

Now, Eve has her own quantum register that she uses to randomize her move, so she turns her quantum register into a coin that allows her to implement the classical mixed strategy, she does this by applying the Haddamard transform first and then she measures the quantum register.

In the next step, Eve hacks the channel applying a NOT gate (X gate) to the content sent by Alice, if her quantum coin yields the result 1, and does not hack the channel otherwise, this will lead to a fifty/fifty probability of hacking.

Now, Bob just has to apply a Haddamard transform to the qubit sent by Alice and measure it. The results of running this game 1024 times on the  ibmq_qasm_simulator is shown below, the first logical value in the string is Eve's, the second is Bob's.




From the results we can see that 49.902% of the time Eve did not hack the channel and Bob received the logical value of "1",  as intended by Alice, and 50.098% of the time Eve hacked the channel and Bob received the logical value of "1", also as intended by Alice. So, again, playing by quantum rules trumps the mixed strategy game, with Alice and Bob winning every time over their opponent Eve.

What if Eve also plays by a quantum rule, for instance, what if Eve is able to get intel on Alice's scheme, using some undercover operative in Alice's organization, without neither Alice nor Bob knowing it? 

Then, there is a response from Eve that is able to hack and disrupt the channel, turning it into a 50/50 noise source for Bob, assuring, in this way, a randomized disruption of the communications' channel. The following code presents each move for the hack, we used barriers to more easily separate the moves of each player.




Running this circuit on the ibmq_qasm_simulator leads to the following results:


With this hack, Bob may receive any bit with equal probability, so that each time the communication channel is activated, there is a random result.

The above results show how quantum strategies can be implemented on actual quantum computers, and some applications to games around the subject matter of quantum cybersecurity.


Running Picard and Q Game on IBM's Quantum Computers

Quantum game theory has evolved through the application of quantum methods to game theory scenarios and it has been used in two settings:

  • To simulate human decision making, in which there has been evidence of quantum-like interference patterns when humans evaluate different alternatives;
  • To simulate the  context where players have access to quantum computers and can play with quantum strategies.

These two settings have led to the development of quantum econophysics with the simulation of financial markets being one of the major contributions (Piotrowski and Sładkowski, 2017; Gonçalves, 2013, 2015).

In the current blog post, we implement an early example of quantum strategies beating classical strategies, using the cloud-based access to IBM's Quantum Computers, in the next blog post we will expand the results to a quantum cybersecurity game.

To build the illustration game for the current blog post, we return to David Meyer's (1999) original article which introduced quantum strategies through the Picard and Q game

For the present purposes, let us consider first the classical version of the game:

Picard and Q are playing a game where they either turn a coin or not without looking at it, Q goes first, then Picard, then Q goes again, they only look at the result in the end, if the coin ends up heads then Picard wins, if it ends up tails then Q wins. The coin is initially with tails facing up.

Each player is playing without knowing what the other player did, so that we have the following scenarios:

1. Q does not turn the coin -> Picard does not turn the coin -> Q does not turn the coin. In this case, the coin sequence from its initial position is:

Tails->Tails->Tails->Tails: Q wins (+1), Picard loses (-1)

2. Q does not turn the coin->Picard does not turn the coin -> Q turns the coin. In this case, the coin sequence from its initial position is:

Tails->Tails->Tails->Heads: Q loses (-1), Picard wins (+1)

3. Q turns the coin -> Picard does not turn the coin -> Q does not turn the coin. In this case, the coin sequence from its initial position is:

Tails->Heads->Heads->Heads: Q loses (-1), Picard wins (+1) 

4. Q turns the coin -> Picard does not turn the coin -> Q turns the coin. In this case, the coin sequence from its initial position is:

Tails->Heads->Heads->Tails: Q wins (+1), Picard loses (-1)

5. Q does not turn the coin -> Picard turns the coin -> Q does not turn the coin. In this case, the coin sequence from its initial position is: 

Tails->Tails->Heads->Heads: Q loses (-1), Picard wins (+1)

6. Q does not turn the coin -> Picard turns the coin -> Q turns the coin. In this case, the coin sequence from its initial position is: 

Tails->Tails->Heads->Tails: Q wins (+1), Picard loses (-1)

7. Q turns the coin -> Picard turns the coin -> Q does not turn the coin. In this case, the coin sequence from its initial position is:

Tails->Heads->Tails->Tails: Q wins (+1), Picard loses (-1) 

8. Q turns the coin -> Picard turns the coin -> Q turns the coin. In this case, the coin sequence from its initial position is:

Tails->Heads->Tails->Heads: Q loses (-1), Picard wins (+1)


These eight scenarios are summarized in the following game matrix:


Game
Picard
Q
Not Turn
Turn
Not Turn, Not Turn
+1,-1
-1,+1
Not TurnTurn 
-1,+1
+1,-1
Turn, Not Turn
-1,+1
+1,-1
Turn, Turn
+1,-1
-1,+1

There are no pure strategies Nash equilibria for this game, however, From Nash's original work (Nash, 1950) we know that such finite games always have an equilibrium, which means that if it is not a pure strategies equilibrium, then it is a mixed strategies equilibrium.

If we consider the classical probabilities we find that if Picard plays Not Turn with 50% probability and Turn with 50% probability then Q is indifferent between each classical pure strategy, that is, he does not win more by changing to one pure strategy in detriment of the other.

On the other hand, if Q plays with 50% probability the solution Turn, Turn or Not Turn, Not Turn, and with 50% probability the solution Turn, Not Turn or Not Turn, Turn, then, Picard will be indifferent between playing any one of his pure strategies that is, he does not win more by changing to one pure strategy in detriment of another.

However, if Q plays a specific quantum strategy, then Q can win every time! That is, there is a quantum strategy that is dominant for Q.

Indeed, let us replace the classical coin by a quantum register representing a quantum coin, with |0> encoding tails and |1> encoding heads, then Q may apply the Haddamard transform leading to the symmetric superposition:

|+> = (|0> + |1>)/sqrt(2) 

Now, if Picard applies a (classical) pure strategy, then, he can either apply the identity gate (not turn the quantum coin) or the NOT gate (turn the quantum coin).

Let us assume that after Picard plays his pure strategy, Q again applies a Haddamard transform, so that we have the following two quantum circuits for each alternative sequence of plays:

Picard does not turn the quantum coin:

Picard turns the quantum coin:



Let us, now, see what happens in each case. If we run each circuit on the IBM's device ibmq_qasm_simulator, then, for the first circuit, when we finally measure the result from playing the game, we get, in 1024 repeated experiments, the following results:


That is, the game always leads to the logical state 0 (Tails), which means that Q always wins.

And what about the second circuit?

If we run it we get, in 1024 repeated experiments, the following results:


Again, Q always wins. So Q always wins independently of what Picard does! Why is that?

Well, the answer is symmetry! Q has placed the register in a symmetric superposition of |0> and |1>, which means that when Picard turns the quantum coin the superposition is unchanged, the same is true when Picard does not turn the quantum coin, the result it is invariant with respect to whatever Picard does, after Picard's move the quantum coin is always in the superposition |+>, which means that Q can now replay his move applying the Haddamard gate which inverts his initial operation and returns it to |0>, that is, to Tails, and so he wins every time.

This also means that if Picard turns with probability "p" or not with probability "1-p", the result is always the same, Q always wins, whatever the strategy, pure or mixed, played by Picard.

This shows how quantum game theory can go beyond the classical results and, playing with quantum strategies, a player can win over the classical Nash equilibrium. In this case, the quantum strategy is strategically dominant for Q over the classical mixed strategy, that is, he always wins more than he would by playing the classical mixed strategy. Meyer (1999) effectively expanded the issue of strategic dominance from the classical level to the quantum level.

Now, we have so far run the game on the simulator, what if we run the game on an actual quantum computer? If we run it on the device ibmq_london, for the first circuit, using 1024 repeated experiments, we get the following results:


As we can see, in 99.707% of the time, Q wins, in the remaining cases, Q loses. It is no longer absolutely certain that Q may win, why is that? 

The answer is that when we ran the circuit in the simulator we were working with an isolated quantum computer (the theoretical device), which means that there was no error, when we run the circuit on the actual physical device, environmental fluctuations introduce error in the quantum computation, which means that there is always risk present, so that Q and Picard are playing a game with each other and with Nature

Therefore, Q wins... most of the time, but not always, however, above 90% probability of winning (in this case very near 100%) is good enough.

The same holds for the second circuit, using again 1024 repeated experiments and the same quantum device, we get:

That is, Q wins 92.383% of the time. So, again, Q wins more than 90% of the time, which is still an advantage over Picard.

The above results show how quantum strategies can be implemented on actual quantum computers, and how quantum strategies can win over classical ones, in the next blog post we will show an example that expands this post's illustration to the subject matter of quantum cybersecurity.

Consulted References

- Piotrowski, E.W., Sładkowski, J. (2017). Quantum game theoretical frameworks in economics. In Haven, Emmanuel (ed.) et al., The Palgrave handbook of quantum models in social science. Applications and grand challenges. New York, NY: Palgrave Macmillan.

- Gonçalves, C.P. (2015). Financial Market Modeling with Quantum Neural Networks. Review of Business and Economics Studies (ROBES), 3(4): 44-63.

- Gonçalves, C.P. (2013). Quantum financial economics - risk and returns. Journal of Systems Science and Complexity, 26(2): 187-200.

- Meyer, D.A. (1999). Quantum Strategies. Phys. Rev. Lett. 82, 1052.

- Nash, J. (1950). Non-Cooperative Games. PhD Thesis, Princeton University.

segunda-feira, 2 de março de 2020

Quantum Hacking, Spying and New Generation Intelligence Technologies

The development of quantum communication technologies raises an important issue, that of quantum cybersecurity, which has two dimensions:

  • The defense against a cyberattack by a sufficiently advanced quantum computer that may be capable of breaking current encryption protocols;
  • The development of a quantum internet with new quantum-based encryption protocols.

The first dimension has been an issue for a while now, in the 2013 article  "The Nature and Content of a New-Generation War" by Col. S.G. Chekinov and Let. Gen. S.A. Bogdanov, published in the scientific journal "Military Though" the authors state that: 

"(...) A quantum computer may turn into a tool of destruction and a 21st century bomb for cyber-attacks to succeed. It will easily crack all codes and gain free, and virtually instant, access to all networks supporting the operation and security of government and military control agencies (...)" (Chekinov and Bogdanov, 2013, pp.18,19).

The NSA and NIST have been involved in efforts to develop post-quantum cryptography and quantum-resistant algorithms with one notable project being the Post-Quantum Cryptography Standardization ProjectIn this context, the research on quantum cybersecurity is critical.

Quantum communication games are ways to provide simple examples of basic dynamics associated with quantum communications, allowing us to address some theoretical properties regarding quantum cybersecurity in the context of quantum communications.

We can use quantum simulators to implement these games. In this case, we will use IBM Quantum Experience resources.

The quantum communication game below is a simple example that explores a few properties of quantum communications linked to measurement and interference and allows one to illustrate basic quantum hacking.

Let us consider, then, the first version of the game. Where Alice wants to send Bob a one-bit information, which means that she wants to send Bob either a "0" or a "1", but she is afraid that Eve may be listening in, then, instead of sending the information as a classical bit she sends Bob a qubit in either the superposition |+>=(|0>+|1>)/sqrt(2), or |->=(|0>-|1>)/sqrt(2).

Now, Bob knows that Alice uses the following coding protocol:

  • |0> ->|+>
  • |1> -> |->


Then, to retrieve the bit that Alice is sending, Bob just has to apply a Hadamard transform to get the original bit. Therefore, if Alice wants to send a 1, we have the following circuit (the barrier is separating Alice's side of the circuit from Bob's):



On the other hand, if Alice wants to send a 0, then we have the following circuit (again, the barrier is separating Alice's side of the circuit from Bob's):



If the circuit was run on the theoretical device, then the result would be 1, for the first case, and 0 for the second, if we run it on a physical device, then, we have noise, which means that we need to run it multiple times to get the dominant result.  This is equivalent to Alice automatically and repeatedly sending qubits encrypted in accordance with the protocol, through a noisy channel, with Bob measuring it at the end.

The following bar charts provide the results from running each circuit 1024 times in the ibmq_london quantum device. We can see that in the first case, Bob gets the right message 90.625% of the times, and in the second case, Bob gets the right message 99.512% of the times.





Now, what if Eve is listening in but does not know Alice and Bob's communication protocol? Then, what Alice did was to encrypt the classical information into a superposition qubit. Which means that if Eve hacks into the channel, measuring Alice's qubit before Bob then Bob will know that the channel has been hacked, and Eve will only get a random distribution of 0 and 1, which means that, with this quantum encryption protocol, Alice and Bob are protected against this type of measurement hack.

As an example, let us consider that Alice wants to send a "1" to Bob (the "0" will just be the same but without the initial X gate), then she will encrypt it as in the protocol, therefore, we have the following quantum circuit (again, the barriers separate each player's moves in this game):


There are two classical registers in this game, Bob and Eve's, Eve will store the result from measuring the qubit sent by Alice, and then Bob will implement the decryption protocol but when he does so, Eve will already have performed a measurement, so that Bob and Eve will get a random distribution over the full computational basis, therefore, the initial message becomes noise. If we run the circuit on the ibmq_qasm_simulator, we get the following results for Bob and Eve.



In this case, Bob will get a "0" about 50% of the time and a "1" about 50% of the time, the same as Eve, with uncorrelated measurements between both players. Bob will automatically know that Eve has hacked the channel and Eve will not know what information Alice sent, the channel becomes in a sense corrupted by noise. In this way the quantum encryption can be stated to have an adaptive response to a quantum measurement hack, securing the channel against this hack.

Now, let us introduce intelligence operations on the part of Eve and assume that Eve has learned of Alice and Bob's protocol, the question is: can Eve hack the channel and fool both Alice and Bob?

She can, the hack is to decrypt Alice's message, measuring the result, re-encrypting Alice's message, using Alice's protocol, and sending the results to Bob. The following circuit shows the hack for the previous circuit:



If the circuit is run on the ibmq_qasm_simulator, we get the following result:



As expected, both Bob and Eve get the right result, Eve knows what Alice is sending and neither Bob nor Alice know that Eve has, effectively, hacked the channel!

Research into quantum encryption algorithms for secure quantum communications has protocols such as the BB84 and the Ekert protocols (Zygelman, 2018). The issue of how to hack quantum encryption protocols is a major point in quantum hacking research.

There are various ways to hack quantum communications, in this research area, cybersecurity, intelligence activities and quantum computation intersect. In quantum communications, eavesdropping is possible without interception, exploiting the features of quantum hardware, in this case, the dead time of single-photon detectors, this was introduced by Weier et al. (2011), the abstract to the article that we quote next shows the basic approach:

"The security of quantum key distribution (QKD) can easily be obscured if the eavesdropper can utilize technical imperfections in the actual implementation. Here, we describe and experimentally demonstrate a very simple but highly effective attack that does not need to intercept the quantum channel at all. Only by exploiting the dead time effect of single-photon detectors is the eavesdropper able to gain (asymptotically) full information about the generated keys without being detected by state-of-the-art QKD protocols. In our experiment, the eavesdropper inferred up to 98.8% of the key correctly, without increasing the bit error rate between Alice and Bob significantly. However, we find an even simpler and more effective countermeasure to inhibit this and similar attacks." (Weier et al., 2011).


Quantum intelligence technologies involves the development of research on the application of quantum technologies to intelligence activities, intersecting Quantum Science and Intelligence Studies. A specific area of research within quantum intelligence technologies is the research into quantum secure communications and how to use them to hack quantum communications systems. While this research is taking its first steps, research into algorithms and hardware issues is fundamental for the advancement of the field.

Of course, the ability of quantum computers to break classical encryption depends upon the development of quantum computation. In the Intelligence Advanced Research Projects Activity (IARPA), there have been some projects into quantum technologies, specifically directed at the advancement of quantum computation:




The majority of the projects above is related to the development of quantum computing technologies. However, in the wider range of quantum intelligence technologies, advancements such as quantum radar research can be expected to be developed in the near-future, especially around the building of a quantum internet, in which case, quantum cryptography and secure quantum communications become a fundamental research area.

Chekinov, S.G. and Bogdanov, S.A. (2013). The Nature and Content of a New-Generation War. Military Thought, 4, 12-23.

Weier, H.,  Krauss, H., Rau, M.,  Fürst, M.,  Nauerth, S. and  Weinfurter, H. (2011). Quantum eavesdropping without interception: an attack exploiting the dead time of single-photon detectors. New Journal of Physics, 13.

Zygelman, B. (2018). A First Introduction to Quantum Computing and Information. Springer.