Shor's algorithm: quantum integer factoring and cryptography impact
Shor's algorithm is a quantum algorithm that factors integers and finds discrete orders in polynomial time, with important implications for public-key cryptography and the development of large-scale quantum computers.
Shor's algorithm is a landmark quantum algorithm introduced by Peter Shor in the mid-1990s. It provides a method to factor large integers or, equivalently, to compute the order of an element modulo N. The algorithm showed that a sufficiently powerful quantum computer could solve an important problem much faster than known classical algorithms, raising profound practical and theoretical questions.
Image gallery
1 ImageProblem and goal
The algorithm addresses integer factorization: given a composite number N, find nontrivial prime factors. This task—finding prime factors—is the basis of widely used public-key schemes. Shor transformed factoring into an instance of order-finding, which a quantum processor can solve efficiently by exploiting superposition and interference.
How it works (high level)
At a conceptual level the quantum part performs period or order finding using the quantum Fourier transform. After preparing superposed states and applying a modular exponentiation operation, a quantum measurement yields information about the period. That information is then processed classically to recover factors. The major logical steps are:
- Reduce factoring to finding the order r of a random integer a modulo N.
- Use a quantum circuit to create a superposition and compute periodic sequence values.
- Apply the quantum Fourier transform and measure to obtain data related to r.
- Use classical postprocessing (continued fractions, gcd) to extract factors.
Complexity and implications
Shor's algorithm runs in polynomial time in the number of digits of N, a dramatic improvement over the best known classical methods whose running time grows superpolynomially for large N. Because the security of widely deployed systems such as RSA and other public-key schemes depends on the practical difficulty of factoring, a fully scalable quantum computer running Shor's algorithm would undermine many current cryptographic systems and has driven interest in quantum-resistant alternatives.
History, experiments and limitations
Since its discovery, Shor's algorithm has been demonstrated on small numbers in laboratory quantum devices, but scaling to the sizes needed to break modern keys requires large, fault-tolerant quantum machines and significant error correction overhead. Progress in qubit quality, coherence times and scalable architectures remains essential before the algorithm poses a real threat to deployed cryptography.
Uses, distinctions and further reading
Beyond its immediate cryptographic implications, Shor's algorithm is a central example in the study of quantum algorithms and complexity theory, illustrating how quantum resources can change computational difficulty classes. The result has motivated work in post-quantum cryptography and in alternative quantum algorithms for problems like discrete logarithms. For introductory surveys and technical expositions see further resources.
Properties
The Shor algorithm is a probabilistic algorithm. In some, depending on the number of repetitions arbitrarily few, cases it leads to no result; the algorithm thus belongs to the class of Monte Carlo algorithms.
- Input: A composite number
.
- Output: A nontrivial factor of
.
- Runtime:
gate operations.
Expiration
The basic idea is that one can factorize back to the determination of the order. This determination can be done effectively using the quantum Fourier transform. One therefore often divides the algorithm into a classical part to reduce the problem and a quantum part that efficiently solves the residual problem.
Classic part
- Choose a number
with
.
- Determine the
,
(for example, using the Euclidean algorithm). If the result is not equal to 1, return this as the solution and terminate. Otherwise, proceed to the next step.
- Using the quantum part (see below), determine the order
of
in the prime residue class group
(the smallest
, such that
). Step 2 ensured that such an
exists.
- Start over at 1 if:
is odd, or
.
- Return
as the solution.
Solution in the last step
Consider the product ( ) - (
) =
. We know after step 3 that holds:
, that it does not hold:
(Step 4) and that does not hold:
(step 3, since is
the smallest number with
and
holds), from which it follows that
contains
nontrivial divisors of ; the Euclidean algorithm for computing the
yields these divisors in polynomial time.
Number of iterations for the partial invention
The probability of obtaining a divisor given a random choice of is at least
, where
the number of distinct prime factors of
(not equal to 2). For example, if
is composed of only two prime factors, one solution is obtained with probability 1/2 per pass, so the probability of failure after
steps is only
.
Quantum Part
- Determine
as a power of 2 with
.
- Initialize the first quantum register (input register) with the superposition (see qubit) of all states
(
is a number less than
). This leads to the state:
.
- Initialize the second register (output register) with the superposition of the states
. The result is the state:
.
- On the first register, perform the quantum Fourier transform where:
such that results in:
.
- Perform a measurement (take the contents of the registers). The probability for the state
with is given by
:
. Here, the relation
or
, so that we can write:
By amplification, this discrete function has characteristic maxima for values of a variable
, which is the relation
. It can be shown that for the given relations of
and there is
at most one such value at fixed
Thus,
computed if
and
are divisor-irrelevant. (The probability for this case is at least ϕ
or Ω
, that is, we get
with high probability after
repetitions).
- Return the computed value
if it is indeed the order of
, otherwise repeat the experiment.
Related articles
Author
AlegsaOnline.com Shor's algorithm: quantum integer factoring and cryptography impact Leandro Alegsa
URL: https://en.alegsaonline.com/art/89988