Elliptic Curves and the Discrete Log Problem (2024)

Two weeks ago I started reading Programming Bitcoin by Jimmy Song with a goal to build a utility library alongside learning. The first few chapters cover the basic mathematics that underpins the asymmetric cryptographic scheme — elliptic curve cryptography (ECC) — that bitcoin uses. This is a cryptographic system that is based on elliptic curves over finite fields where a randomly selected private key is used to easily generate a public key but where the converse is computationally difficult/impossible.

But what are elliptic curves? What are finite fields? Why is ECC used in bitcoin?

Elliptic Curves and the Discrete Log Problem (2)

To answer these questions, I need a better understanding of the foundational mathematics used in ECC. In this article I summarized what I learned about the following: elliptic curves, finite fields, groups, group law, and finite cyclic groups, the discrete logarithm problem (DLP) and elliptic curve discrete logarithm problem (ECDLP).

One way to think about the equation that describes an elliptic curve is to consider a stack of oranges arranged in such a way that each level contains a square matrix of oranges forming a pyramid. For example, level 4 at the base of the stack will contain (4 x 4) = 16 oranges, level 3 will contain (3 x 3) = 9 oranges, level 2 will have (2 x 2) = 4 oranges, and level 1 (1 x 1) = 1 orange. Consider an interesting problem of rearranging an n-level stack of oranges into a single square matrix. Would it be possible to have a square matrix if there were 3 levels in the stack? To find out if this is possible we have to take the sum of the square of each level and then compute the square root. If the square root is an integer then we have a solution.

Elliptic Curves and the Discrete Log Problem (3)
Elliptic Curves and the Discrete Log Problem (4)

The equations above represents an elliptic curve. Given the knowledge of two points on the curve, the third can be found by the intersection of the elliptic curve and the straight line passing through the two known points.

Why is this equation and finding its solution important? To answer this we must understand what finite fields and groups are.

A thing is said to be finite if it has definable/definite limits. Thus, finite fields are any fields (abstraction of numbers) with a finite set of elements. This means that there is a countable number of elements in the set representing the size/order of the set. Finite fields also have mathematically operations (addition and multiplication) that can be performed on the elements in the set such that the results of these operations are closed, i.e. are in the set. The following must hold true for finite fields:

  1. These operators, addition (+) and multiplication (.), perform binary operations
  2. The result of adding element c and d must be in the set, making addition closed.
  3. There exists a neutral element 0 such that 0 + c = c
  4. There exists the identity element 1 such that 1.c = c
  5. There exist -c such that -c + c = 0
  6. There exists the inverse of c such that
Elliptic Curves and the Discrete Log Problem (5)

7. There exist prime fields where the order of the finite field is a prime number p where the elements in the set (mod p) of this field are {0, 1, 2, …, p — 1}

These conditions hold true because of modulo arithmetic that allow oversized results to wrapped around the divisor with the remainder falling within the boundary defined by the divisor. The snippet below shows how to implement a finite field element in Python.

The combination of a finite field and an elliptic curve over this field gives rise to an interesting entity — a group. If you have a finite field and an elliptic curve defined over the field such that the rules for the addition of two points on the curve results in a third, on the same curve, then we have a group.

Groups typically have one law, which is point addition (+) that extends the necessary conditions of a finite field operation. These conditions are:

Additive Identity: Given a point P(x,y) on the elliptic curve, there exists an identity element 0(x,y) such that 0 + P = P. This identity element is known as the point at infinity.

Additive Inverse: Given a point P(x,y) on the curve, there exists another point P(x,-y) such that -P + P = 0 .

Point Addition: Given two points P₁(x₁, y₁) and P₂(x₂, y₂) on the elliptic curve, the third point P(x, y) is computed by calculating the slope (m) through P₁ and P₂, and substituting into the equation of the line that passes through either P₁ or P₂ and P₃. The equations are as shown below and hold true for cases where P₁ is not P₂.

Elliptic Curves and the Discrete Log Problem (6)
Elliptic Curves and the Discrete Log Problem (7)
Elliptic Curves and the Discrete Log Problem (8)

Point Doubling: When P₁ = P₂, doubling is said to occur. Here P₁ + P₂ = P₁ + P₁ = 2P₁. The line formed is tangent to the point P₂ and passes through the third (technically second) point. The slope for this line is found by taken the derivative of the elliptic curve equation. The equation to compute y₃ remains unchanged however, the slope and x₃ equations change as shown below.

Elliptic Curves and the Discrete Log Problem (9)
Elliptic Curves and the Discrete Log Problem (10)

Scalar multiplication: What point doubling shows us is that we can perform a new kind of operation called scalar multiplication where P + P = 2P and 2 is a scalar multiple. This property is nonlinear and gives rise to two important considerations: finite cyclic groups and the discrete log problem.

Finite Cyclic Groups:

At some scalar multiple (n) of a select P, we compute the point at infinity nP = 0. For the select P, this means that there exists a finite set of multiples of P called a finite cyclic group. And plot of {P, 2P, 3P, 4P, …, nP} over a finite field is a scattershot of points showing the non-linearity of point addition in finite cyclic groups. This non-linearity is a great property in cryptographic systems because computing the scalar multiple of a select point is easy but predicting the value of the scalar given a point is quite difficult. This is the discrete logarithm problem (DLP).

A point on a simplified elliptic curve y² = x³ + ax + b can be implemented in Python as shown below.

The generalized discrete logarithm problem in a finite field is one that defines the difficulty of finding an integer x within the range of 1 and p — 1 if there exists:

  1. A finite cyclic group with an order of p — 1
  2. A primitive element (α) which belongs to the finite cyclic group
  3. A derivative element (β) such that αˣ = β

Computing the value of x is very hard if the parameters (p, α, β) are sufficiently large, even though computing the value of β is much easier.

Extending this, a DLP can be constructed with elliptic curves. Formally, the elliptic curve discrete logarithm problem (ECDLP) is the problem of finding an integer value e within the bounds of 1 and the number of points on the elliptic curve (which ~= the order of the finite cyclic group), such that the scalar multiplication of a primitive element G with e, i.e. eG, produces another point P on the elliptic curve.

In cryptographic systems e represents the uniformly selected random number that is the private key, G represents the generator point, P the derived public key.

Elliptic curves and the DLP are important because they form the primitives of ECC. With sufficiently large values for the order of the finite cyclic group (n), the generator point (G), and the order of a finite field (p), an elliptic curve discrete logarithm problem can be implemented for security- and privacy-conscious systems. The values bitcoin uses (see Programming Bitcoin, Chapter 3, Page 59) large enough to not have a successful attack against and known to provide long-term security with a time span of decades.

ECC, when compared with schemes in the same asymmetric algorithm family, provides the same security level with significantly smaller key lengths. For example, to achieve a security level of 128 bits, ECC requires 256-bit long keys, while 3072 bits is the minimum requirement for the same security level in others. Handling key lengths of 256 bits is much practical with better speeds than 3072 length keys.

Note:

  1. If you are interested in the implementation of field and group operations in Python, here is a link to the code base for Programming Bitcoin. An implementation in C++ is contained in Chapter 9 of Pro Cryptography and Cryptanalysis.
  2. If the resources above are too exhaustive, you can check out my repository. It has a much smaller footprint and contains code written alongside learning from Programming Bitcoin.
  1. Song, J. (2019). Programming bitcoin: Learn how to program bitcoin from scratch O’Reilly Media.
  2. Hankerson, D., Menezes, A., & Vanstone, S. (2004). Guide to elliptic curve cryptography Springer.
  3. Paar, C., & Pelzl, J. (2010). Understanding cryptography (2. corr. printing ed.). Springer.
  4. Mihailescu, M., Iulian, & Nita, S., Loredana. (2021). Pro cryptography and cryptanalysis with C++20: Creating and programming advanced algorithms Apress.
Elliptic Curves and the Discrete Log Problem (2024)

FAQs

What is the discrete logarithm problem for the elliptic curve? ›

Let E be an elliptic curve over a finite field Fq, where q = pn and p is prime. The elliptic curve discrete logarithm problem (ECDLP) is the following computational problem: Given points P, Q ∈ E(Fq) to find an integer a, if it exists, such that Q = aP.

Why is the discrete log problem hard? ›

So while the DLP is generally considered a “hard problem", its difficulty really depends not on the order of the group (or its structure), but on how the group is explicitly rep- resented. Every group of prime order p is isomorphic to Z/pZ; computing the discrete logarithm amounts to computing this isomorphism.

What is the ECDLP problem in math? ›

Formally, the elliptic curve discrete logarithm problem (ECDLP) is the problem of finding an integer value e within the bounds of 1 and the number of points on the elliptic curve (which ~= the order of the finite cyclic group), such that the scalar multiplication of a primitive element G with e, i.e. eG, produces ...

What is the fastest algorithm for discrete logarithms? ›

The Pohlig-Hellman algorithm can be used to speed up the computation of discrete logarithms when any non-trivial factors of the group order q are known.

What is the difference between DLP and ECDLP? ›

Security Comparison

The primary reason for the enhanced security of ECDLP over DLP lies in the difference in their respective problem spaces. For a given security level, the ECDLP requires a significantly smaller key size compared to the DLP.

What is an example of a discrete log problem? ›

Discrete Logarithm Problem

For example, take the equation 3k≡12 (mod 23) for k. As shown above k=4 is a solution, but it is not the only solution. Since 322≡1 (mod 23), it also follows that if n is an integer then 34+22n≡12×1n≡12 (mod 23). Hence the equation has infinitely many solutions of the form 4+22n.

Is discrete log problem NP complete? ›

We do not have polynomial-time algorithms for quantum computers to solve problems that are known to be NP-complete. This suggests strongly that discrete logarithm and integer factorization are not NP-complete. So even if we could prove P≠NP, it would not prove that discrete logarithm is hard.

What is the complexity of the discrete log problem? ›

The discrete logarithm problem (DLP) in a finite group is the basis for many protocols in cryptography. The best general algorithms which solve this problem have a time complexity of O(√NlogN) O ( N log N ) and a space complexity of O(√N) , where N is the order of the group.

Why is discrete logarithm important in cryptography? ›

The discrete logarithm problem is a cornerstone of modern cryptography, providing the foundation for the security of the Diffie-Hellman key exchange protocol. Its computational difficulty ensures that securely exchanged keys remain confidential, enabling secure communication over potentially insecure channels.

What is the hardest math problem called? ›

1. Riemann Hypothesis. The Riemann Hypothesis, proposed by Bernhard Riemann in 1859, is a central problem in number theory, and discusses the distribution of prime numbers. The hypothesis focuses on the zeros of the Riemann zeta function.

What is the most famous problem in math? ›

Famous Problems in Mathematics and Their Solutions
  1. The Riemann Hypothesis. ...
  2. The Birch and Swinnerton-Dyer Conjecture. ...
  3. The P versus NP Problem. ...
  4. The Collatz Conjecture.
Feb 16, 2024

What is the math problem that is impossible to solve? ›

One of the greatest unsolved mysteries in math is also very easy to write. Goldbach's Conjecture is, “Every even number (greater than two) is the sum of two primes.” You check this in your head for small numbers: 18 is 13+5, and 42 is 23+19. Computers have checked the Conjecture for numbers up to some magnitude.

Why is the discrete logarithm problem hard to solve? ›

The discrete logarithm problem is considered to be computationally intractable. That is, no efficient classical algorithm is known for computing discrete logarithms in general. A general algorithm for computing logb a in finite groups G is to raise b to larger and larger powers k until the desired a is found.

Is the discrete logarithm unique? ›

So, discrete logarithms are not unique when the answer is considered an integer. However, discrete logarithms are unique when the answer is considered an integer mod phi.

What is quantum algorithm for discrete logarithms? ›

The quantum algorithm for discrete log solves a particular instance of the hidden subgroup problem (HSP). for some unknown subgroup H ≤ G. We say that such a function hides H. The goal of the HSP is to learn H (say, specified in terms of a generating set) using queries to f.

What is the discrete logarithm DL problem? ›

The Discrete Logarithm (DL) problem asks, given P, Q ∈ G, for the integer x mod p such that xP = Q. The Diffie-Hellman (DH) problem asks, given P, Q, R ∈ G, for the element S ∈ G such that z ≡ xy (mod p), where Q = xP, R = yP, S = zP.

What is the discrete logarithm problem in groups? ›

Let G be a group written in multiplicative notation. The discrete logarithm problem (DLP) is: Given g, h ∈ G to find a, if it exists, such that h = ga. We sometimes denote a by logg(h). As discussed after Definition 2.1.

What is the generalized discrete logarithm problem? ›

The Generalized Discrete Logarithm Problem (GDLP) represents an extension of the traditional Discrete Logarithm Problem (DLP), which is fundamental in the realm of cryptography, particularly in the security of protocols such as the Diffie-Hellman key exchange.

What is the equation of elliptic curve? ›

In most situations, an Elliptic Curve E is the graph of an equation of the form y2 = x3 + Ax + B, where A and B are constants. This is called the Weierstrass equation for an elliptic curve. Also, A, B, x, y are usually elements of some field.

Top Articles
Retirement Planning and importance of Retirement Plans
Operation Old-Age Finances – Sorting Out A Pension – The Money Whisperer
Uca Cheerleading Nationals 2023
Dlnet Retiree Login
Obor Guide Osrs
Identifont Upload
Kokichi's Day At The Zoo
Here are all the MTV VMA winners, even the awards they announced during the ads
Mail Healthcare Uiowa
Learn How to Use X (formerly Twitter) in 15 Minutes or Less
Current Time In Maryland
Conan Exiles Colored Crystal
Weather Rotterdam - Detailed bulletin - Free 15-day Marine forecasts - METEO CONSULT MARINE
All Obituaries | Buie's Funeral Home | Raeford NC funeral home and cremation
Zoe Mintz Adam Duritz
Uta Kinesiology Advising
Music Go Round Music Store
ABCproxy | World-Leading Provider of Residential IP Proxies
Homeaccess.stopandshop
2013 Ford Fusion Serpentine Belt Diagram
Where to eat: the 50 best restaurants in Freiburg im Breisgau
All Breed Database
Sec Baseball Tournament Score
Rogue Lineage Uber Titles
Обзор Joxi: Что это такое? Отзывы, аналоги, сайт и инструкции | APS
Airline Reception Meaning
Jackie Knust Wendel
Netspend Ssi Deposit Dates For 2022 November
Nikki Catsouras: The Tragic Story Behind The Face And Body Images
Poe T4 Aisling
How Much Is An Alignment At Costco
Indiana Jones 5 Showtimes Near Jamaica Multiplex Cinemas
Everything You Need to Know About NLE Choppa
Wednesday Morning Gifs
Closest 24 Hour Walmart
A Man Called Otto Showtimes Near Amc Muncie 12
Reborn Rich Ep 12 Eng Sub
450 Miles Away From Me
Mvnt Merchant Services
140000 Kilometers To Miles
US-amerikanisches Fernsehen 2023 in Deutschland schauen
Dragon Ball Super Super Hero 123Movies
Scythe Banned Combos
Copd Active Learning Template
Zom 100 Mbti
Craigslist Sparta Nj
Blippi Park Carlsbad
Blog Pch
Craiglist.nj
March 2023 Wincalendar
Divisadero Florist
Suzanne Olsen Swift River
Latest Posts
Article information

Author: Duane Harber

Last Updated:

Views: 6766

Rating: 4 / 5 (71 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Duane Harber

Birthday: 1999-10-17

Address: Apt. 404 9899 Magnolia Roads, Port Royceville, ID 78186

Phone: +186911129794335

Job: Human Hospitality Planner

Hobby: Listening to music, Orienteering, Knapping, Dance, Mountain biking, Fishing, Pottery

Introduction: My name is Duane Harber, I am a modern, clever, handsome, fair, agreeable, inexpensive, beautiful person who loves writing and wants to share my knowledge and understanding with you.