Cryptography

Quantum Computing and Elliptic Curve Cryptography

Published on September 11, 2026

Quantum Computing and Elliptic Curve Cryptography

In the last post, we have learned what an elliptic curve is, how it is used in cryptography and we saw an example of how Alice can encrypt her message to Bob using Bob's public key and her own private key. We also saw how Bob is able to decrypt this message by multiplying Alice's public key with his private key and subtracting the result from the encrypted message to get the clear text message.

An eavesdropper, by the name of Eve, has seen the exchanges between Alice and Bob and she wants to be able to decrypt the message of Alice. However, she only sees the public keys of Alice and Bob, the encrypted message, the elliptic curve equation used and the modulus. How can she decrypt the message?

Discrete Logarithm Problem

Eve knows both the public key of Alice and Bob. If she can somehow compute the private key, she will be able to decrypt the message. The public key of Alice is

Alice Public Key=Pa=eaB\text{Alice Public Key} = P_a = e_a B

Where eae_a is the private key of Alice and BB is the base point of the elliptic curve agreed before hand by Alice and Bob. Using a group theoretic notation, we can also write this as

Pa=BeaP_a = B^{e_a}

where the group "multiplication" operation is defined at the addition of points defined in the last blog post, that is,

Bn=B+B+Bn timesB^n = \underbrace{B+B+B}_{\text{n times}}

and B0=OB^0 = O, the identity element (point at infinity).

If Pa=BeaP_a = B^{e_a}, then

ea=logBPae_a = \log_{B} P_a

Solving for eae_a is called the discrete logarithm problem.

Quantum Algorithm

If Eve has access to a quantum computer, she can use Shor's Algorithm to find the value of eae_a. The trick to using Shor's algorithm is to create a periodic function ff such that the period of ff is eae_a. To do this, define

f(a,b)=Baeabf(a,b) = B^{a-e_ab}

If (a1,b1)(a_1,b_1) and (a2,b2)(a_2,b_2), notice that f(a2,b2)=f(a1,b1)f(a_2,b_2) = f(a_1, b_1) if (a2,b2)=(a1,b1)+k(ea,1)(a_2, b_2) = (a_1, b_1) + k(e_a,1). To see this,

f(a2,b2)=Ba2eab2=B(a1+kea)ea(b1+k)=Ba1+keaeab1kea=Ba1eab1=f(a1,b1)\begin{array}{rl} f(a_2,b_2) &= B^{a_2-e_ab_2} = B^{(a_1+ke_a) - e_a(b_1+k)}\\ &= B^{a_1+ke_a - e_ab_1 - ke_a}\\ &= B^{a_1 - e_ab_1}\\ &= f(a_1,b_1) \end{array}

Eve will prepare 2 input registers and prepare the quantum state to be a superposition of all values of the basis vectors ab\left\vert a\right\rangle\left\vert b\right\rangle

1pa=0p1b=0p1ab0\displaystyle \frac{1}{p}\sum_{a=0}^{p-1}\sum_{b=0}^{p-1} \left|a\right\rangle\left|b\right\rangle\otimes\left|0\right\rangle

She will then apply an operator Uf\mathbf{U}_f defined as

Ufab0=abf(a,b)\mathbf{U}_f \left|a\right\rangle \left|b\right\rangle\left|0\right\rangle = \left|a\right\rangle \left|b\right\rangle\left|f(a,b)\right\rangle

to get

1pa=0p1b=0p1abf(a,b)\displaystyle \frac{1}{p} \sum_{a=0}^{p-1}\sum_{b=0}^{p-1} \left|a\right\rangle\left|b\right\rangle\left|f(a,b)\right\rangle

where ff is the periodic function defined as above.

A measurement of the output register system will then yield a specific value ff, which corresponds to mm values of aa and bb because of the periodic nature of the function:

1mk=0m1a0+keab0+k\displaystyle \frac{1}{\sqrt{m}} \sum_{k=0}^{m-1} \left|a_0 + ke_a\right\rangle\left|b_0+k\right\rangle

To solve for eae_a, we apply the Quantum Fourier Transform as defined here:

UFTUFT1mk=0m1a0+keab0+k=1mk=0m1UFTa0+keaUFTb0+k=1(p1)mk=0m1x=0p2y=0p2e2πi(a0+kea)x/(p1)e2πi(b0+k)y/(p1)xy=1(p1)mk=0m1x=0p2y=0p2e2πi/(p1)[(a0x+b0y)+k(eax+y)]xy=1(p1)mx=0p2y=0p2e2πi(a0x+b0y)/(p1)k=0m1e2πik(eax+y)/(p1)xy\begin{array}{lr} \displaystyle \mathbf{U}_{\mathbf{FT}}\otimes\mathbf{U}_{\mathbf{FT}}\frac{1}{\sqrt{m}} \sum_{k=0}^{m-1} \left|a_0 + ke_a\right\rangle\left|b_0+k\right\rangle\\ = \displaystyle \frac{1}{\sqrt{m}} \sum_{k=0}^{m-1} \mathbf{U}_{\mathbf{FT}}\left|a_0 + ke_a\right\rangle\otimes \mathbf{U}_{\mathbf{FT}}\left|b_0+k\right\rangle\\ = \displaystyle \frac{1}{(p-1)\sqrt{m}} \sum_{k=0}^{m-1} \sum_{x=0}^{p-2}\sum_{y=0}^{p-2}e^{2\pi i (a_0+ke_a)x/(p-1)} e^{2\pi i (b_0+k)y/(p-1)}\left|x\right\rangle\left|y\right\rangle\\ = \displaystyle \frac{1}{(p-1)\sqrt{m}} \sum_{k=0}^{m-1} \sum_{x=0}^{p-2}\sum_{y=0}^{p-2}e^{2\pi i/(p-1) [(a_0x + b_0y) +k(e_ax +y)]}\left|x\right\rangle\left|y\right\rangle\\ = \displaystyle \frac{1}{(p-1)\sqrt{m}} \sum_{x=0}^{p-2}\sum_{y=0}^{p-2}e^{2\pi i (a_0x + b_0y)/(p-1)} \sum_{k=0}^{m-1} e^{2\pi i k(e_ax +y)/(p-1)}\left|x\right\rangle\left|y\right\rangle\\ \end{array}

The probability of getting a specify xx and yy is given by the square of the amplitudes:

1(p1)2mk=0m1e2πik(eax+y)/(p1)\displaystyle \frac{1}{(p-1)^2m}\underbrace{\left|\sum_{k=0}^{m-1} e^{2\pi i k(e_ax +y)/(p-1)}\right|}

If we let

f=eax+yp1\displaystyle f = \frac{e_ax +y}{p-1}

we can write the quantity in underbrace as

sin2(πfm)sin2(πf)\displaystyle \frac{\sin^2(\pi fm)}{\sin^2(\pi f)}

which is maximum when ff is an integer, that is,

eax+y=0modp1e_ax + y = 0 \mod p-1

After a measurement of the input registers, we get a specific value of xx and yy. We can then compute the private key using:

ea=yx1modp1e_a = -y x^{-1} \mod p-1

where x1x^{-1} is the inverse of xmodp1x \mod p-1.

Example

Suppose after we measure the input registers, we get the values x=51, y=44. We can compute for the private key as follows:

ea=yx1modp1=44(51)1mod70=44(11)mod70=6\begin{array}{rl} e_a &= -y x^{-1} \mod p-1\\ &= -44(51)^{-1} \mod 70\\ &= -44(11) \mod 70\\ &= 6 \end{array}

Decrypting the Message

Suppose we are given the following parameters: The elliptic curve equation is y2=x33x+3mod71y^2 = x^3 - 3x +3 \mod 71 , the base point is (0,28)(0,28), Alice's public key is (61,58)(61,58), Bob's public key is (30,2)(30,2) and the encrypted message is (23,12)(23,12).

Eve uses the Quantum Computer to compute Alice private key to get ea=6e_a = 6. She can then multiply Bob's public key with Alice's private key to get 6×(30,2)=(10,60)6\times (30,2) = (10,60). Subtracting this from the encrypted text, we get (23,12)+(10,60)=(17,54)(23,12) + (10,-60) = (17,54), which is the decrypted message.

Image Credit: "Print Gallery solved (2003) - H.W. Lenstra (1949)" by pedrosimoes7 is marked with CC BY 2.0. To view the terms, visit https://creativecommons.org/licenses/by/2.0/?ref=openverse