I know that Quantum Computing and its concepts are very difficult to understand. And my aim here is to look at some basic concepts with simple code snippets.
As a developer, we don’t need to understand the implementation details of the algorithm or the mathematics behind them. But in my opinion, it will be better to get some specialized lectures. For interested readers, I will share some useful links.
Quantum computing will greatly impact many areas such as Security, Finance, Artificial Intelligence, Simulation, Medicine, etc.
It is not a replacement for classical computing and they are not next-generation computers. We will continue using classical computers and we will use quantum computers for special purposes such as exponential advantage, factoring very large numbers
Quantum computing qubits maintain multiple states, whereas parallel programming is used to run multiple tasks simultaneously on multiple processors.
Quantum computers are based on the principles of superconducting and operate at a very low temperature, absolute zero — (-273.15 °C).
It is very expensive so we won’t be able to use it at our homes. (Cloud).
Classic computers use bits, which are represented only by 0 or 1 like switches. Quantum computers use Qubits are represented as both 0 and 1.
One qubit can take the value of two bits. Two qubits can take the values of four bits. In general, n qubits can take the values 2ⁿ.
Superposition: It is a quantum principle of a sub-atomic system that can be in multiple states at the same time. For example, an electron spin is in a superposition of up(1) and down (0). Being in a superposition does not mean that the spin of the electron is in either the up or down state. We simply don’t know until it is measured. To put qubits into superposition; precision lasers or microwave beams can be used.
Entanglement: A qubit has a %50 chance of 00 or 11, never 01 or 10. If we change the state of one pair and its state is measured; the state of the other particle is determined as well. The concept is important in quantum cryptography and quantum communication.
Measurement: We can define measurement as the testing or manipulation of a physical system to a numerical result.
Let’s pick a number between 1 and 8. And assume that we already know that it is 5. But in a real scenario, we won’t be able to know it.
If we used a classical computer to solve this problem we have to use 8 queries in the worst case. But we only use 3 qubits and get 8 possible outcomes with the help of with quantum Grover Algorithm. (2³)
Hamdard Gate: Brings the qubit in a superposition state. Qubits are made of sub-atomic particles that work with subatomic laws (photon, electron). Before measuring, it is in the superposition state.
Oracle: It is like an API call. We don’t know what it does (like blackbox) but we can give the inputs and receive outputs by the help of oracle.
Grovers Search Algorithm: A quantum algorithm for unstructured search. We can think of it as a function that returns true for one of its possible inputs but false for all the others. The aim here is to find the true answer. When applied we increase the probability of measuring correct responses while decreasing the probability of measuring wrong responses.
But here in our example, we have given that the solution is 5. If we have already provided the solution, what is the meaning of using this algorithm? We use it, just for demonstration purposes. Just think of a password and we want to find the correct combination. Our system doesn’t have to know the answer but there should be a correct password already set by the admin, to make our system work.
Shortly Grover’s Algorithm consists of an Oracle(selects the correct answer with the wrong answers) and a Diffuser (makes the correct answer more significant when compared to the wrong answer).
Grovers Diffusion Opreator is used to increase probability.
Quantum Networking: Combination of small quantum computers. Qubit can not be copied but can be transferred over long distances. And if the hacker wants to intercept he has to measure qubit. And when measured the information is lost. If photons are used for data transfer, we can use fiber optics telecom infrastructure. Preserving the state of qubits is possible by quantum repeaters.
StrangeFx: A development tool to visualize and debug our applications. However, we can’t use debugging not to lose any information. Instead, we use ProbabilitiesGate to visualize the probability of distributions at a given time in the program flow. In this way, we can get the possible outcomes, after each step, without measuring the qubits. Probability is always a number between 0,1 but amplitudes are complex numbers or negative numbers obeying different rules.
In StrangeFx, we use Renderer.renderProgram to generate a window and visualize.
101 is the binary representation of number 5.
What about security:
It will take seconds to crack the RSA cryptosystem by using 4,000 error-free qubits. For now, it is about 433 qubits. So we will face a cybersecurity threat soon.
Quantum Key Distribution with BB84
Quantum Key Distribution is a safe and secure method for exchanging encryption keys between remote parties. And BB84 is known as the first quantum cryptography protocol. Photons can’t be copied and are only measured once. The communicating participants create a key between them, by filtering photons. So if anyone intercepts the communication and the keys don’t match we know that someone is listening to our communication. Polarization direction is important and both parties create their filter. The intersection of matching filters will be used and others will be eliminated and the key will be ready.
Photons oscillate in one direction when polarized. With the help of filters we can polarize them. When we use a photon polarized in up and down direction and use a lengthwise filter, it will be able to pass. But it can’t pass if a crosswise filter is used. PersonA will send some photons and filters and mark them and PersonB will mark and hold the filters according to the received lights. And in the end, there will be a comparison for both PersonA and PersonB filters. And the successful filters will be used to create a key. We can use gates for filters.
Quantum Attacks: It will be enough to use AES 256 as we need 6681 logical qubits according to Kryptera. And it seems far at least today.
- 2,953 logical qubits for AES-128 bit key encryption
- 4,449 logical qubits for AES-192 bit key encryption
- 6,681 logical cubits for AES-256 bit key encryption
Thanks for reading. The java source code is available on GitHub.