Docsity

Quantum Computing and Cryptography II, Lecture notes of Mathematics

Toggle sidebar
bg1
19
Quantum computing and cryptography II
Bellโ€™s Inequality is powerful demonstration that there is some-
thing very strange going on with quantum mechanics. But could this
โ€œstrangenessโ€ be of any use to solve computational problems not
directly related to quantum systems? A priori, one could guess the
answer is no. In 1994 Peter Shor showed that one would be wrong:
Theorem 19.1 โ€” Shorโ€™s Theorem. The map that takes an integer ๐‘š
into its prime factorization is efficiently quantumly computable.
Specifically, it can be computed using ๐‘‚(log3๐‘š)quantum gates.
This is an exponential improvement over the best known classical
algorithms, which as we mentioned before, take roughly 2๎ป 
๐‘‚(log1/3๐‘š)
time.
We will now sketch the ideas behind Shorโ€™s algorithm. In fact, Shor
proved the following more general theorem:
Theorem 19.2 โ€” Order Finding Algorithm. There is a quantum polyno-
mial time algorithm that given a multiplicative Abelian group ๐”พ
and element ๐‘”โˆˆ๐”พcomputes the order of ๐‘”in the group.
Recall that the order of ๐‘”in ๐”พis the smallest positive integer ๐‘Žsuch
that ๐‘”๐‘Ž=1. By โ€œgiven a groupโ€ we mean that we can represent the
elements of the group as strings of length ๐‘‚(log |๐”พ|)and there is a
๐‘๐‘œ๐‘™๐‘ฆ(log |๐”พ|)algorithm to perform multiplication in the group.
19.1 FROM ORDER FINDING TO FACTORING AND DISCRETE LOG
The order finding problem allows not just to factor integers in polyno-
mial time, but also solve the discrete logarithm over arbitrary Abelian
groups, hereby showing that quantum computers will break not just
RSA but also Diffie Hellman and Elliptic Curve Cryptography. We
merely sketch how one reduces the factoring and discrete logarithm
Compiled on 11.17.2021 22:35
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Quantum Computing and Cryptography II and more Lecture notes Mathematics in PDF only on Docsity!

Quantum computing and cryptography II

Bellโ€™s Inequality is powerful demonstration that there is some- thing very strange going on with quantum mechanics. But could this โ€œstrangenessโ€ be of any use to solve computational problems not directly related to quantum systems? A priori, one could guess the answer is no. In 1994 Peter Shor showed that one would be wrong:

Theorem 19.1 โ€” Shorโ€™s Theorem. The map that takes an integer ๐‘š into its prime factorization is efficiently quantumly computable. Specifically, it can be computed using ๐‘‚(log^3 ๐‘š) quantum gates.

This is an exponential improvement over the best known classical algorithms, which as we mentioned before, take roughly 2 ๐‘‚(log1/3ฬƒ^ ๐‘š) time. We will now sketch the ideas behind Shorโ€™s algorithm. In fact, Shor proved the following more general theorem:

Theorem 19.2 โ€” Order Finding Algorithm. There is a quantum polyno- mial time algorithm that given a multiplicative Abelian group ๐”พ and element ๐‘” โˆˆ ๐”พ computes the order of ๐‘” in the group.

Recall that the order of ๐‘” in ๐”พ is the smallest positive integer ๐‘Ž such that ๐‘”๐‘Ž^ = 1. By โ€œgiven a groupโ€ we mean that we can represent the elements of the group as strings of length ๐‘‚(log |๐”พ|) and there is a ๐‘๐‘œ๐‘™๐‘ฆ(log |๐”พ|) algorithm to perform multiplication in the group.

19.1 FROM ORDER FINDING TO FACTORING AND DISCRETE LOG The order finding problem allows not just to factor integers in polyno- mial time, but also solve the discrete logarithm over arbitrary Abelian groups, hereby showing that quantum computers will break not just RSA but also Diffie Hellman and Elliptic Curve Cryptography. We merely sketch how one reduces the factoring and discrete logarithm

Compiled on 11.17.2021 22:

364 an intensive introduction to cryptography

problems to order finding: (see some of the sources above for the full details)

  • For factoring , let us restrict to the case ๐‘š = ๐‘๐‘ž for distinct ๐‘, ๐‘ž. Recall that we showed that finding the size (๐‘ โˆ’ 1)(๐‘ž โˆ’ 1) = ๐‘š โˆ’ ๐‘ โˆ’ ๐‘ž + 1 of the group โ„คโˆ—๐‘š is sufficient to recover ๐‘ and ๐‘ž. One can show that if we pick a few random ๐‘ฅโ€™s in โ„คโˆ—๐‘š and compute their order, the least common multiplier of these orders is likely to be the group size.
  • For discrete log in a group ๐”พ, if we get ๐‘‹ = ๐‘”๐‘ฅ^ and need to recover ๐‘ฅ, we can compute the order of various elements of the form ๐‘‹๐‘Ž๐‘”๐‘. The order of such an element is a number ๐‘ satisfying ๐‘(๐‘ฅ๐‘Ž + ๐‘) = 0 (mod |๐”พ|). Again, with a few random examples we will get a non trivial example (where ๐‘ โ‰  0 (mod |๐”พ|) ) and be able to recover the unknown ๐‘ฅ.

19.2 FINDING PERIODS OF A FUNCTION: SIMONโ€™S ALGORITHM

Let โ„ be some Abelian group with a group operation that weโ€™ll denote by โŠ•, and ๐‘“ be some function mapping โ„ to an arbitrary set (which we can encode as {0, 1}โˆ—). We say that ๐‘“ has period โ„Žโˆ—^ for some โ„Žโˆ—^ โˆˆ โ„ if for every ๐‘ฅ, ๐‘ฆ โˆˆ โ„, ๐‘“(๐‘ฅ) = ๐‘“(๐‘ฆ) if and only if ๐‘ฆ = ๐‘ฅ โŠ• ๐‘˜โ„Žโˆ—^ for some integer ๐‘˜. Note that if ๐”พ is some Abelian group, then if we define โ„ = โ„ค|๐”พ|, for every element ๐‘” โˆˆ ๐”พ, the map ๐‘“(๐‘Ž) = ๐‘”๐‘Ž^ is a periodic map over โ„ with period the order of ๐‘”. So, finding the order of an item reduces to the question of finding the period of a function. How do we generally find the period of a function? Let us consider the simplest case, where ๐‘“ is a function from โ„ to โ„ that is โ„Žโˆ—^ periodic for some number โ„Žโˆ—, in the sense that ๐‘“ repeats itself on the intervals [0, โ„Žโˆ—], [โ„Žโˆ—, 2โ„Žโˆ—], [2โ„Žโˆ—, 3โ„Žโˆ—], etc.. How do we find this number โ„Žโˆ—? The key idea would be to transform ๐‘“ from the time to the frequency do- main. That is, we use the Fourier transform to represent ๐‘“ as a sum of wave functions. In this representation wavelengths that divide the period โ„Žโˆ—^ would get significant mass, while wavelengths that donโ€™t would likely โ€œcancel outโ€. Similarly, the main idea behind Shorโ€™s algorithm is to use a tool known as the quantum fourier transform that given a circuit computing the function ๐‘“ โˆถ โ„ โ†’ โ„, creates a quantum state over roughly log |โ„| qubits (and hence dimension |โ„|) that corresponds to the Fourier transform of ๐‘“. Hence when we measure this state, we get a group element โ„Ž with probability proportional to the square of the corre- sponding Fourier coefficient. One can show that if ๐‘“ is โ„Žโˆ—-periodic then we can recover โ„Žโˆ—^ from this distribution. Shor carried out this approach for the group โ„ = โ„คโˆ—๐‘ž for some ๐‘ž, but we will start be seeing this for the group โ„ = {0, 1}๐‘›^ with

366 an intensive introduction to cryptography

(^1) In the context of Fourier transform it is customary and convenient to denote the ๐‘ฅ๐‘กโ„Ž^ coordinate of a vector ๐‘“ by ๐‘“(๐‘ฅ) rather than ๐‘“๐‘ฅ.

Simonโ€™s algorithm seems to really use the special bit-wise structure of the group {0, 1}๐‘›, so one could wonder if it has any relevance for the group โ„คโˆ—๐‘š for some exponentially large ๐‘š. It turns out that the same insights that underlie the well known Fast Fourier Transform (FFT) algorithm can be used to essentially follow the same strategy for this group as well.

19.3 FROM SIMON TO SHOR

(Note: The presentation here is adapted from the quantum computing chapter in my textbook with Arora.) We now describe how to achieve Shorโ€™s algorithm for order finding. We will not do this for a general group but rather focus our attention on the group โ„คโˆ—โ„“ for some number โ„“ which is the case of interest for integer factoring and the discrete logarithm modulo primes problems. That is, we prove the following theorem:

Theorem 19.4 โ€” Shorโ€™s Algorithm, restated. For every โ„“ and ๐‘Ž โˆˆ โ„คโˆ—โ„“, there is a quantum ๐‘๐‘œ๐‘™๐‘ฆ(๐‘™๐‘œ๐‘”โ„“) algorithm to find the order of ๐‘Ž in โ„คโˆ—โ„“.

The idea is similar to Simonโ€™s algorithm. We consider the map ๐‘ฅ โ†ฆ ๐‘Ž๐‘ฅ( mod โ„“) which is a periodic map over โ„ค๐‘š where ๐‘š = |โ„คโˆ—โ„“| with period being the order of ๐‘Ž. To find the period of this map we will now need to perform a Quan- tum Fourier Transform (QFT) over the group โ„ค๐‘š instead of {0, 1}๐‘›. This is a quantum algorithm that takes a register from some arbitrary state ๐‘“ โˆˆ โ„‚๐‘š^ into a state whose vector is the Fourier transform ๐‘“ ฬ‚of ๐‘“. The QFT takes only ๐‘‚(log^2 ๐‘š) elementary steps and is thus very efficient. Note that we cannot say that this algorithm โ€œcomputesโ€ the Fourier transform, since the transform is stored in the amplitudes of the state, and as mentioned earlier, quantum mechanics give no way to โ€œread outโ€ the amplitudes per se. The only way to get information from a quantum state is by measuring it, which yields a single basis state with probability that is related to its amplitude. This is hardly repre- sentative of the entire Fourier transform vector, but sometimes (as is the case in Shorโ€™s algorithm) this is enough to get highly non-trivial information, which we do not know how to obtain using classical (non-quantum) computers.

19.3.1 The Fourier transform over โ„ค๐‘š We now define the Fourier transform over โ„ค๐‘š (the group of integers in {0, โ€ฆ , ๐‘š โˆ’ 1} with addition modulo ๐‘š). We give a definition that is specialized to the current context. For every vector ๐‘“ โˆˆ โ„‚๐‘š, the Fourier transform of ๐‘“ is the vector ๐‘“ ฬ‚where the ๐‘ฅ๐‘กโ„Ž^ coordinate of ๐‘“ ฬ‚is defined as^1

quantum computing and cryptography ii 367

๐‘“(๐‘ฅ) =ฬ‚ โˆš^1

๐‘š โˆ‘๐‘ฆโˆˆโ„ค๐‘š^ ๐‘“(๐‘ฅ)๐œ”

๐‘ฅ๐‘ฆ where ๐œ” = ๐‘’2๐œ‹๐‘–/๐‘š. The Fourier transform is simply a representation of ๐‘“ in the Fourier basis {๐œ’๐‘ฅ}๐‘ฅโˆˆโ„ค๐‘š , where ๐œ’๐‘ฅ is the vector/function whose ๐‘ฆ๐‘กโ„Ž^ coordinate is โˆš๐‘š๐œ”^1 ๐‘ฅ๐‘ฆ. Now the inner product of any two vectors ๐œ’๐‘ฅ, ๐œ’๐‘ง in this basis is equal to

โŸจ๐œ’๐‘ฅ, ๐œ’๐‘งโŸฉ = (^) ๐‘š^1 โˆ‘ ๐‘ฆโˆˆโ„ค๐‘š

๐œ”๐‘ฅ๐‘ฆ๐œ”๐‘ง๐‘ฆ^ = ๐‘š^1 โˆ‘

๐‘ฆโˆˆโ„ค๐‘š

๐œ”(๐‘ฅโˆ’๐‘ง)๐‘ฆ^.

But if ๐‘ฅ = ๐‘ง then ๐œ”(๐‘ฅโˆ’๐‘ง)^ = 1 and hence this sum is equal to 1. On the other hand, if ๐‘ฅ โ‰  ๐‘ง, then this sum is equal to (^) ๐‘š^1 1โˆ’๐œ” (๐‘ฅโˆ’๐‘ฆ)๐‘š 1โˆ’๐œ”๐‘ฅโˆ’๐‘ฆ^ = 1 ๐‘š 1โˆ’ 1โˆ’๐œ”๐‘ฅโˆ’๐‘ฆ^ = 0^ using the formula for the sum of a geometric series. In other words, this is an orthonormal basis which means that the Fourier transform map ๐‘“ โ†ฆฬ‚ ๐‘“ is a unitary operation. What is so special about the Fourier basis? For one thing, if we identify vectors in โ„‚๐‘š^ with functions mapping โ„ค๐‘š to โ„‚, then itโ€™s easy to see that every function ๐œ’ in the Fourier basis is a homomorphism from โ„ค๐‘š to โ„‚ in the sense that ๐œ’(๐‘ฆ + ๐‘ง) = ๐œ’(๐‘ฆ)๐œ’(๐‘ง) for every ๐‘ฆ, ๐‘ง โˆˆ โ„ค๐‘š. Also, every function ๐œ’ is periodic in the sense that there exists ๐‘Ÿ โˆˆ โ„ค๐‘š such that ๐œ’(๐‘ฆ + ๐‘Ÿ) = ๐œ’(๐‘ง) for every ๐‘ฆ โˆˆ โ„ค๐‘š (indeed if ๐œ’(๐‘ฆ) = ๐œ”๐‘ฅ๐‘ฆ^ then we can take ๐‘Ÿ to be โ„“/๐‘ฅ where โ„“ is the least common multiple of ๐‘ฅ and ๐‘š). Thus, intuitively, if a function ๐‘“ โˆถ โ„ค๐‘š โ†’ โ„‚ is itself periodic (or roughly periodic) then when representing ๐‘“ in the Fourier basis, the coefficients of basis vectors with periods agreeing with the period of ๐‘“ should be large, and so we might be able to discover ๐‘“โ€™s period from this representation. This does turn out to be the case, and is a crucial point in Shorโ€™s algorithm.

19.3.2 Fast Fourier Transform. Denote by FT ๐‘š the operation that maps every vector ๐‘“ โˆˆ โ„‚๐‘š^ to its Fourier transform ๐‘“. The operationฬ‚ FT ๐‘š is represented by an ๐‘š ร— ๐‘š matrix whose (๐‘ฅ, ๐‘ฆ)th entry is ๐œ”๐‘ฅ๐‘ฆ. The trivial algorithm to compute it takes ๐‘š^2 operations. The famous Fast Fourier Transform (FFT) algo- rithm computes the Fourier transform in ๐‘‚(๐‘š log ๐‘š) operations. We now sketch the idea behind the FFT algorithm as the same idea is used in the quantum Fourier transform algorithm. Note that ๐‘“(๐‘ฅ) =ฬ‚ โˆš^1 ๐‘š โˆ‘ ๐‘ฆโˆˆโ„ค๐‘š^ ๐‘“(๐‘ฆ)๐œ”

โˆš^1 ๐‘š โˆ‘๐‘ฆโˆˆโ„ค๐‘š,๐‘ฆ ๐‘’๐‘ฃ๐‘’๐‘› ๐‘“(๐‘ฆ)๐œ”

โˆ’2๐‘ฅ(๐‘ฆ/2) + ๐œ”๐‘ฅ โˆš^1

Now since ๐œ”^2 is an ๐‘š/2th root of unity and ๐œ”๐‘š/2^ = โˆ’1, letting ๐‘Š be the ๐‘š/2 ร— ๐‘š/2 diagonal matrix with diagonal entries ๐œ”^0 , โ€ฆ , ๐œ”๐‘š/2โˆ’1, we get that FT ๐‘š(๐‘“)๐‘™๐‘œ๐‘ค = FT ๐‘š/2(๐‘“๐‘’๐‘ฃ๐‘’๐‘›) + ๐‘Š FT ๐‘š/2(๐‘“๐‘œ๐‘‘๐‘‘) FT ๐‘š(๐‘“)โ„Ž๐‘–๐‘”โ„Ž = FT ๐‘š/2(๐‘“๐‘’๐‘ฃ๐‘’๐‘›) โˆ’ ๐‘Š FT ๐‘š/2(๐‘“๐‘œ๐‘‘๐‘‘)

quantum computing and cryptography ii 369

(^2) To compute this map we may need to extend the register by some additional ๐‘๐‘œ๐‘™๐‘ฆ๐‘™๐‘œ๐‘”(๐‘) many qubits, but we can ignore them as they will always be equal to zero except in intermediate computations.

to be the result of applying for every ๐‘– โˆˆ {0, โ€ฆ , ๐‘š โˆ’ 2} the following elementary operation on the ๐‘–๐‘กโ„Ž^ qubit of the register: |0โŸฉ โ†ฆ |0โŸฉ and |1โŸฉ โ†ฆ ๐œ”^2 ๐‘– |1โŸฉ. The final state is equal to ๐‘“ ฬ‚by the FFT equations (we leave this as an exercise)

19.4 SHORโ€™S ORDER-FINDING ALGORITHM.

We now present the central step in Shorโ€™s factoring algorithm: a quan- tum polynomial-time algorithm to find the order of an integer ๐‘Ž mod- ulo an integer โ„“.

Theorem 19.6 โ€” Order finding algorithm, restated. There is a polynomial- time quantum algorithm that on input ๐ด, ๐‘ (represented in bi- nary) finds the smallest ๐‘Ÿ such that ๐ด๐‘Ÿ^ = 1 (mod ๐‘ ).

Let ๐‘ก = โŒˆ5 log(๐ด + ๐‘ )โŒ‰. Our register will consist of ๐‘ก + ๐‘๐‘œ๐‘™๐‘ฆ๐‘™๐‘œ๐‘”(๐‘ ) qubits. Note that the function ๐‘ฅ โ†ฆ ๐ด๐‘ฅ^ (mod ๐‘ ) can be computed in ๐‘๐‘œ๐‘™๐‘ฆ๐‘™๐‘œ๐‘”(๐‘ ) time and so we will assume that we can compute the map |๐‘ฅโŸฉ|๐‘ฆโŸฉ โ†ฆ |๐‘ฅโŸฉ|๐‘ฆ โŠ• (๐ด๐‘ฅ^ (mod ๐‘ โŸฉ)) (where we identify a number ๐‘‹ โˆˆ {0, โ€ฆ , ๐‘ โˆ’ 1} with its representation as a binary string of length log ๐‘ ).^2 Now we describe the order-finding algorithm. It uses a tool of elementary number theory called continued fractions which allows us to approximate (using a classical algorithm) an arbitrary real num- ber ๐›ผ with a rational number ๐‘/๐‘ž where there is a prescribed upper bound on ๐‘ž (see below) We now describe the algorithm and the state, this time including normalizing factors.

  1. Apply Fourier transform to the first ๐‘š bits. (state: โˆš^1 ๐‘š โˆ‘๐‘ฅโˆˆโ„ค๐‘š |๐‘ฅโŸฉ)|0๐‘›โŸฉ)
  2. Compute the transformation |๐‘ฅโŸฉ|๐‘ฆโŸฉ โ†ฆ |๐‘ฅโŸฉ|๐‘ฆ โŠ• (๐ด๐‘ฅ^ (mod ๐‘ โŸฉ)). (state: โˆš^1 ๐‘š โˆ‘๐‘ฅโˆˆโ„ค๐‘š |๐‘ฅโŸฉ|๐ด๐‘ฅ^ (mod ๐‘ โŸฉ))
  3. Measure the second register to get a value ๐‘ฆ 0. (state: โˆš^1 ๐พ โˆ‘

๐พโˆ’ โ„“=0 |๐‘ฅ^0 + โ„“๐‘ŸโŸฉ|๐‘ฆ^0 โŸฉ^ where^ ๐‘ฅ^0 is the smallest number such that ๐ด๐‘ฅ^0 = ๐‘ฆ 0 (mod ๐‘ ) and ๐พ = โŒŠ(๐‘š โˆ’ 1 โˆ’ ๐‘ฅ 0 )/๐‘ŸโŒ‹.)

  1. Apply the Fourier transform to the first register. (state: โˆš^1 ๐‘šโˆš๐พ (โˆ‘๐‘ฅโˆˆโ„ค๐‘›^ โˆ‘

๐พโˆ’ โ„“=0 ๐œ”

In the analysis, it will suffice to show that this algorithm outputs the order ๐‘Ÿ with probability at least ฮฉ(1/ log ๐‘ ) (we can always am- plify the algorithmโ€™s success by running it several times and taking the smallest output).

370 an intensive introduction to cryptography

19.4.1 Analysis: the case that ๐‘Ÿ|๐‘š We start by analyzing the algorithm in the case that ๐‘š = ๐‘Ÿ๐‘ for some integer ๐‘. Though very unrealistic (remember that ๐‘š is a power of 2 !) this gives the intuition why Fourier transforms are useful for detecting periods.

Claim: In this case the value ๐‘ฅ measured will be equal to ๐‘Ž๐‘ for a random ๐‘Ž โˆˆ {0, โ€ฆ , ๐‘Ÿ โˆ’ 1}. The claim concludes the proof since it implies that ๐‘ฅ/๐‘š = ๐‘Ž/๐‘Ÿ where ๐‘Ž is random integer less than ๐‘Ÿ. Now for every ๐‘Ÿ, at least ฮฉ(๐‘Ÿ/ log ๐‘Ÿ) of the numbers in [๐‘Ÿ โˆ’ 1] are co-prime to ๐‘Ÿ. Indeed, the prime number theorem says that there at least this many primes in this interval, and since ๐‘Ÿ has at most log ๐‘Ÿ prime factors, all but log ๐‘Ÿ of these primes are co-prime to ๐‘Ÿ. Thus, when the algorithm computes a rational approximation for ๐‘ฅ/๐‘š, the denominator it will find will indeed be ๐‘Ÿ. To prove the claim, we compute for every ๐‘ฅ โˆˆ โ„ค๐‘š the absolute value of |๐‘ฅโŸฉโ€™s coefficient before the measurement. Up to some normalization factor this is โˆฃโˆ‘๐‘โˆ’1โ„“=0 ๐œ”(๐‘ฅ^0 +โ„“๐‘Ÿ)๐‘ฅโˆฃ = โˆฃ๐œ”๐‘ฅ^0 ๐‘โ€ฒ๐‘โˆฃ โˆฃโˆ‘๐‘โˆ’1โ„“=0 ๐œ”๐‘Ÿโ„“๐‘ฅโˆฃ = 1 โ‹… โˆฃโˆ‘๐‘โˆ’1โ„“=0 ๐œ”๐‘Ÿโ„“๐‘ฅโˆฃ. If ๐‘ does not divide ๐‘ฅ then ๐œ”๐‘Ÿ^ is a ๐‘๐‘กโ„Ž^ root of unity, so โˆ‘๐‘โˆ’1โ„“=0 ๐‘ค๐‘Ÿโ„“๐‘ฅ^ = 0 by the formula for sums of geometric progressions. Thus, such a number ๐‘ฅ would be measured with zero probability. But if ๐‘ฅ = ๐‘๐‘— then ๐œ”๐‘Ÿโ„“๐‘ฅ^ = ๐‘ค๐‘Ÿ๐‘๐‘—โ„“^ = ๐œ”๐‘€๐‘—^ = 1, and hence the amplitudes of all such ๐‘ฅโ€™s are equal for all ๐‘— โˆˆ {0, 2, โ€ฆ , ๐‘Ÿ โˆ’ 1}.

19.4.2 The general case In the general case, where ๐‘Ÿ does not necessarily divide ๐‘š, we will not be able to show that the measured value ๐‘ฅ satisfies ๐‘š|๐‘ฅ๐‘Ÿ. However, we will show that with ฮฉ(1/ log ๐‘Ÿ) probability, (1) ๐‘ฅ๐‘Ÿ will be โ€œalmost divisibleโ€ by ๐‘š in the sense that 0 โ‰ค ๐‘ฅ๐‘Ÿ (mod ๐‘š) < ๐‘Ÿ/10 and (2) โŒŠ๐‘ฅ๐‘Ÿ/๐‘šโŒ‹ is coprime to ๐‘Ÿ. Condition (1) implies that |๐‘ฅ๐‘Ÿ โˆ’ ๐‘๐‘€| < ๐‘Ÿ/10 for ๐‘ = โŒŠ๐‘ฅ๐‘Ÿ/๐‘šโŒ‹. Dividing by ๐‘Ÿ๐‘€ gives โˆฃ (^) ๐‘š๐‘ฅ โˆ’ ๐‘๐‘Ÿ โˆฃ < (^) 10๐‘€^1. Therefore, ๐‘๐‘Ÿ is a rational number with denominator at most ๐‘ that approximates (^) ๐‘š๐‘ฅ to within 1/(10๐‘€) < 1/(4๐‘ 4 ). It is not hard to see that such an approximation is unique (again left as an exercise) and hence in this case the algorithm will come up with ๐‘/๐‘Ÿ and output the denominator ๐‘Ÿ. Thus all that is left is to prove the next two lemmas. The first shows that there are ฮฉ(๐‘Ÿ/ log ๐‘Ÿ) values of ๐‘ฅ that satisfy the above two con- ditions and the second shows that each is measured with probability ฮฉ((1/

๐‘Ÿ)^2 ) = ฮฉ(1/๐‘Ÿ).

Lemma 1: There exist ฮฉ(๐‘Ÿ/ log ๐‘Ÿ) values ๐‘ฅ โˆˆ โ„ค๐‘š such that:

  1. 0 < ๐‘ฅ๐‘Ÿ (mod ๐‘š) < ๐‘Ÿ/

372 an intensive introduction to cryptography

then write ๐›ผ = โŒŠ๐›ผโŒ‹ +

If we continue this process for ๐‘› steps, we get a rational number, de- noted by [๐‘Ž 0 , ๐‘Ž 1 , โ€ฆ , ๐‘Ž๐‘›], which can be represented as ๐‘ ๐‘ž๐‘›๐‘› with ๐‘๐‘›, ๐‘ž๐‘› coprime. The following facts can be proven using induction:

  • ๐‘ 0 = ๐‘Ž 0 , ๐‘ž 0 = 1 and for every ๐‘› > 1, ๐‘๐‘› = ๐‘Ž๐‘›๐‘๐‘›โˆ’1 + ๐‘๐‘›โˆ’2, ๐‘ž๐‘› = ๐‘Ž๐‘›๐‘ž๐‘›โˆ’1 + ๐‘ž๐‘›โˆ’2.
  • ๐‘ ๐‘ž๐‘›๐‘› โˆ’ ๐‘ ๐‘ž๐‘›โˆ’1๐‘›โˆ’1 = (โˆ’1) ๐‘›โˆ’ ๐‘ž๐‘›๐‘ž๐‘›โˆ’

Furthermore, it is known that โˆฃ ๐‘ ๐‘ž๐‘›๐‘› โˆ’ ๐›ผโˆฃ< (^) ๐‘ž๐‘›๐‘ž^1 ๐‘›+1 (โˆ—) which implies

that ๐‘ ๐‘ž๐‘›๐‘› is the closest rational number to ๐›ผ with denominator at most ๐‘ž๐‘›. It also means that if ๐›ผ is extremely close to a rational number, say, โˆฃ๐›ผ โˆ’ ๐‘Ž๐‘ โˆฃ < (^) 4๐‘^14 for some coprime ๐‘Ž, ๐‘ then we can find ๐‘Ž, ๐‘ by iterating the continued fraction algorithm for ๐‘๐‘œ๐‘™๐‘ฆ๐‘™๐‘œ๐‘”(๐‘) steps. Indeed, let ๐‘ž๐‘› be the first denominator such that ๐‘ž๐‘›+1 โ‰ฅ ๐‘. If ๐‘ž๐‘›+1 > 2๐‘^2 then (โˆ—) implies that โˆฃ ๐‘ ๐‘ž๐‘›๐‘› โˆ’ ๐›ผโˆฃ < (^) 2๐‘^12. But this means that ๐‘ ๐‘ž๐‘›๐‘› = ๐‘Ž๐‘ since there is at most one rational number of denominator at most ๐‘ that is so close to ๐›ผ. On the other hand, if ๐‘ž๐‘›+1 โ‰ค 2๐‘^2 then since ๐‘ ๐‘ž๐‘›+1๐‘›+1 is closer to ๐›ผ than ๐‘Ž๐‘ , โˆฃ ๐‘ ๐‘ž๐‘›+1๐‘›+1 โˆ’ ๐›ผโˆฃ < (^) 4๐‘^14 , again meaning that ๐‘ ๐‘ž๐‘›+1๐‘›+1 = ๐‘Ž๐‘. Itโ€™s not hard to verify

that ๐‘ž๐‘› โ‰ฅ 2๐‘›/2, implying that ๐‘๐‘› and ๐‘ž๐‘› can be computed in ๐‘๐‘œ๐‘™๐‘ฆ๐‘™๐‘œ๐‘”(๐‘ž๐‘›) time.

19.5.1 Quantum cryptography There is another way in which quantum mechanics interacts with cryptography. These โ€œspooky actions at a distanceโ€ have been sug- gested by Weisner and Bennet-Brassard as a way in which parties can create a secret shared key over an insecure channel. On one hand, this concept does not require as much control as general-purpose quantum computing, and so it has in fact been demonstrated physically. On the other hand, unlike transmitting standard digital information, this โ€œinsecure channelโ€ cannot be an arbitrary media such as wifi etc.. but rather one needs fiber optics, lasers, etc.. Unlike quantum computers, where we only need one of those to break RSA, to actually use key exchange at scale we need to setup these type of networks, and so it is unclear if this approach will ever dominate the solution of Alice sending to Bob a Brinkโ€™s truck with the shared secret key. People have proposed some other ways to use the interesting properties of quan- tum mechanics for cryptographic purposes including quantum money and quantum software protection.