In the previous chapter, we started playing around with qubits and used them to build a quantum random number generator with a simulator that we built in Python. In this chapter, we see that qubits can help us with encryption (or other cryptographic tasks) by letting us securely distribute secret keys. There are classical methods for sharing random keys (e.g., RSA), but they have different guarantees about the security of the sharing.
We have a quantum random number generator from chapter 2, but that’s only half of what we need to share secrets with our friends. We need to share those random numbers with our friends if we want to use the quantum random numbers to communicate securely with them. Those random numbers (often called a key) can be used with encryption algorithms that combine the randomness of the key with information people want to keep secret in such a way that only someone else with the key can see the information. We can see in figure 3.1 how two people could use a key (here, a random binary string) to encrypt and decrypt messages between themselves.