Encryption is the science of converting information into a form that is readable only by the recipient. In modern times, the Data Encryption Standard (DES), meaning the same key is used to encrypt the plaintext and decrypt the cyphertext. DES was replaced later by Advanced Encryption Standard (AES) in 2001. It uses a substitution-permutation network which is a series of linked mathematical operations. Decryption occurs by reversing the order of the network.
We'll focus on the RSA algorithm. It is:
antisymmetric (has a private and public key)
popular, public-key based
crucial component of the public key infrastructure on which most internet transactions are done
Here the public key is published for all to see, while the private key is only known between the sender and recipient. To use it:
Alice encrypts her message, the plaintext using the public key
She sends the message, the encoded cyphertext to Bob.
Bob uses the private key to decipher the message.
It relies on the fact that large-enough prime numbers are difficult to factor, even for a computer. The General Number Field Sieve (GNFS) algorithm is the fastesst well-known classical integer factorization algorithm. It would take the following time to factor these sized-numbers:
768 bit number (232 digits) - 1500 years
1024 bit number - 1.5 Million years
DigiCert 2048 bit SSL certificate 617 digit number - 6.4 Quadrillion years
6.8.1: Modular Exponentiation
Assume a large composite integer number with two distinct primes where . According to number theory, there exists a periodic function with period such that:
where is an integer, , coprime with or and coprime with . The period and is called the Carmichael Totient Function.
Example
For instance, let .
Then .
Then
Assume . Generating the table:
Notice in the table it's periodic every 6-th entry, which agrees with .
Summary
To do the RSA process:
Select two large primes . For example, .
Calculate , the composite number, where . Here
Calculate the period via . Here .
Find public exponent where is coprime to ()while . Here assume since
Calculate , the private exponent using modular inverse, namely . Here .
Now we have the public exponent and private one . With this, we can try to perform the encryption of the message "A"
Encryption: public key and which is the ASCII for "A" character.
Decryption: private key and have
6.8.2: Period Estimation
If are known, it is easy to find . But only if is known, then it's hard, ensuring the security of RSA. Once is known, it's easy to calculate using and RSA fails to be secure. Finding the value of is called order finding or period estimation. Shor's algorithm is the quantum version of period estimation.
Ch 7.2: Quantum Fourier Transform
7.2.1: Classical Fourier Transformation
The Fourier Transformation (see Lecture Notes#page=113) is a reversible linear transformation. It converts signal in the time domain into a signal in the frequency domain. Hence, it has a lot of applications to image and signal processing. The equation (in case you don't use the link above) is:
where , and is the frequency and is the time. This equation is the forward transform, but we can do the inverse transform as well:
Note
We get, as an output of the Fourier transform, a period function of , namely where where is the period.
We can see that since we have we can conclude that complex sinusoidal functions are the basis functions of the signal. Think of them as unit vectors in a complex plane at a rate of radians per second:
7.2.2: Discrete Fourier Transform (DFT)
The Discrete Fourier Transform is equivalent to the CFT (Continuous Fourier Transform); however it applies to samples taken at time intervals.
Let's assume is the continuous signal under consideration. We take samples of this signal x[0], ..., x[N-1]. Each sample x[k] is taken after a time from the previous sample x[k-1]. the signal is periodic. Thus, we can assume the data in the range x[0], ..., x[N-1] are the same as the data x[N], ..., x[2N-1]. Hence, we can turn:
Which becomes the summation:
The sample data is periodic (as we said above), so we should calculate the DFT for the fundamental frequency and its harmonics:
Applying this equation to the summation above, we get (after normalization):
where . Here is called the DFT of the sampled data response . The sampling is done at uniform intervals of time . The output is a vector of complex numbers that encodes the amplitude and phase of a sinusoidal wave of frequency :
where . The term is a normalization constant and the DFT is unitary (just like a gate).
The Inverse DFT is given by:
where .
7.2.3: Quantum Fourier Transformation
Recall from the previous sections that the DFT takes in a vector and maps it to another vector . Similarly, the Quantum Fourier Transform acts on a quantum state and maps it into a state . The transformation is given by:
where and is called the primitive -th root of unity. Assuming is a basis state, the QFT can be written as the mapping:
In matrix form it's exactly as what we said the DFT matrix was:
As an example, assume a qubit in state . For this qubit and . We can calculate the QFT as:
Similarly, we'd get:
THus then:
Which is equivalent to doing an gate!!!!
Recall that the gate transforms the -basis (the computational basis ) into the -basis (the polar basis ). Similarly, we can define the QFT as the transformation from the computational basis to the Fourier basis. With this assumption, we can write our for the 2-qubit case as:
Let's calculate the QFT for large states . Assume . In this convention, is the most significant bit:
We can expand in the computational basis , the range of the sum becomes :
Again, here each is some toggle for a bit, either 0 or 1. Using this we get:
The exponential of a sum becomes a product of exponentials. With some cancellation:
When doing a product of vectors with constants, the constants combine and the vectors tensor up:
Thus:
Then by rearranging the sum and product operators:
Expanding the sum part:
Note that we can expand the exponent part of the previous equation by expanding as a binary number:
Like what we did in expanding the sum above, we can expand this into it's 0,1 parts:
For the first exponent, notice there loop definition restricts so then . So then the sum is just some integer, and because for any then the whole expression just becomes 1:
Where the internal sum expands as:
Recall that a binary fraction is expanded as:
Thus we can put this into our final equation:
The inverse QFT can be implemented and derived by using .
Ch 7.11: Quantum Phase Estimation (QPE)
Given an eigenvector of unitary operator , such that , where , the goal of this algorithm is to find the eigenvalue for . This is equivalent to finding the phase to some accuracy. This phase estimation algorithm is used in Shor's Algorithm (see the next week for more on that).
The quantum phase estimation procedure is similar to the method used to perform arithmetic in the Fourier basis. Each of the successive blocks of the controlled gates kickbacks a phase into the upper block, called a counting register. It sums up to a value proportional to the phase factor . An inverse QFT is applied to the counting register to convert this to the computational basis again, which we measure and post-process.
Summary
The steps are:
Start .
Apply to the part to put into superpositions. Now .
Apply a cascade of gates for each qubit.
Apply inverse QFT.
After step 2 we have:
Since is unitary, then:
Applying this logic into our previous equation:
Rewriting:
If we do the as the algorithm describes:
When then the makes the whole thing 1, so then:
Thus if we can measure this vector's probability, then can be estimated as we know . The estimation error is namely since we only get a per-qubit estimation (we can only measure discrete state values). In more mathematical terms, we have the amplitudes where:
(continue on pg. 348)
Ch 7.9: Shor's Algorithm
I would read Reading Week 8 - More on Quantum Algorithms#Ch 6.8 RSA Security if you haven't already. In there we learned that the period of a function could be used to factorize into two prime number such that . Recall that was a number that was coprime to and that:
Peter Shor proposed a novel quantum algorithm to factorize large integers in polynomial time. The largest currently factored integer using this method is 261980999226229. He solved the problem by shifting the problem domain to finding the period of the modular exponentiation function. The problem is as follows:
Problem
Given and two prime numbers where , let . Let a moldular exponentiation function where , where satisfies the condition where where is the period of and is some integer.
Shor's algorithm is trying to determine the period by querying . The block diagram is:
An interesting feature of Shor's is the use of inverse QFT to find . The period can be used to find the factors for once known.
The algorithm uses two banks of qubit registers. The upper bank is called the source register while the lower one is the target register. The oracle (shown in green) performs modular exponentiation on the source register and stores the values in the target register. The process is done in one step using quantum parallelism.
The number of qubits in the source and target must be in the following range:
Using this range then and it guaruntees that when estimating that terms are contributing to the probability amplitude, even if . Using a large ensures a dense solution space so can be estimated accurately as possible.
Before starting the algorithm, we need to preprocess some thing. For one, we should check that is a prime number, using a classical computer (which can be done efficiently). The next thing is to identify and confirm that are coprime. Lastly, we should determine (by choosing any suitable value).
Running the Algorithm
We start with both registers in for everything:
We apply to the source to have an equal superposition:
Next we apply modular exponentiation using the oracle. For all states of the source register we calculate and store that in the target .
7.7 Review
We can calculate by:
Calculating
Dividing by and giving the remainder
If we have in its binary form we can expand the modular exponentiation to:
We can do this idea in Quantum Circuits using the modular exponentiation block:
The idea here is that each of the controlled multiplier blocks performs a multiplication of the input register 2, by a constant function . Each controlled multiplier is controlled by a respective qubit in register 1. If we assume is the control cubits and as the target in register 2, then the operation produces:
For example, doing is as follows. Consider the circuit:
Here q[0], q[1], q[2] forms and the other qubits form .
The state after and the gate is:
The application of the first block multiplier makes:
Applying does something similar:
Applying the last finishes the process:
We see if we try to measure that we get only with equal probability. We can compare these values with the following table and see that the left ket makes as we wanted (keeping in mind the flippded order):
Back to the Algorithm
We can used this generalized exponentiation process as follows:
as we desired. After doing this, we measure the target register. This is because we want to see the point where we get a return back to , if at all. It has the side effect of collapsing our superposition of the source register to the states for which . Since is periodic via , then the possible values are of the form . Note that is the least such that is what was measured in the target register. This ensures is strictly nonnegative. Thus our new state is:
Since the period of is , the measurement reduces the range of the source register to . There are states, so the maximum number of periods we can have is .
But this is why we want to apply the inverse QFT! Because we are guarunteed to get a period for some value , then we can apply inverse AFT to identify this period , which is what we are after. This gate does:
for . Applying the gives:
Which (saving you the trouble) reduces down to:
You can't use 'macro parameter character #' in math mode= \frac{1}{\sqrt{2^{s}Q}}\sum\limits_{y=0}^{2^{s}-1} e^{\frac{-2\pi i x_{0} y}{2^{s}}} \sum\limits_{k=0}^{Q-1}\left(\exp\left(-2\pi i \frac{ry}{2^{s}}\right)\right)^{k}\ket{y} $${ #1fdfasdf} The right side summation is a geometric series which is non-zero iff $\exp\frac{-2\pi i ry}{2^{s}}= 1$. This is possible if $\frac{ry}{2^{s}}$ is an integer, so values of $y$ which are multiples of $\frac{2^{s}}{r}$ can have non-zero amplitudes. In other words, if $\frac{2^{s}}{r}$ is an integer, by constructive wave interference, there is a peak values in the value of $y$, which will thus become measured more often. We can try to calculate this probability: { #7dead2}
P(y) = \frac{1}{2^{s}Q}\left| \sum\limits_{k=0}^{Q-1} \exp\left(-2\pi i \frac{kry}{2^{s}}\right)\right|^