Chapter 3. Elliptic Curve Cryptography

The previous two chapters covered some fundamental math. We learned how finite fields work and what an elliptic curve is. In this chapter, we’re going to combine the two concepts to learn elliptic curve cryptography. Specifically, we’re going to build the primitives needed to sign and verify messages, which is at the heart of what Bitcoin does.

Elliptic Curves over Reals

We discussed in Chapter 2 what an elliptic curve looks like visually because we were plotting the curve over real numbers. Specifically, it’s not just integers or even rational numbers, but all real numbers. Pi, sqrt(2), e+7th root of 19, and the like are all real numbers.

This worked because real numbers are also a field. Unlike a finite field, there are an infinite number of real numbers, but otherwise the same properties hold:

  1. If a and b are in the set, a + b and ab are in the set.

  2. 0 exists and has the property a + 0 = a.

  3. 1 exists and has the property a ⋅ 1 = a.

  4. If a is in the set, –a is in the set, which is defined as the value that makes a + (–a) = 0.

  5. If a is in the set and is not 0, a–1 is in the set, which is defined as the value that makes aa–1 = 1.

Clearly, all of these are true: normal addition and multiplication apply for the first part, the additive and multiplicative identities 0 and 1 exist, –x is the additive inverse, and 1/x is the multiplicative inverse.

Real numbers are easy to plot on a graph. For example, y2 = x3 + 7 can be plotted like ...

Get Programming Bitcoin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.