Foundations of Blockchain
上QQ阅读APP看书,第一时间看更新

Operations on elliptic curves

Elliptic curves used in cryptography are curves that are constructed in a finite field. They have the following form:

y= x3 + ax + b mod (p)

The modulus operation on p indicates that the curve is over a finite field of prime numbers of the order p. We need to understand some terminology and operations of elliptic curves before moving on to the cryptographic applications.

A finite field is a field with a finite number of elements defined by parameter p, which is a prime number. Thus, the finite field is Fp = {0, . . ., p-1}. It is represented by modulo p in the equation.

All the elements used in ECC must be agreed upon by the cryptography actors. These elements are called elliptical curve domain parameters. {p, a, b, G, n, h} are the parameters used in ECC. These parameters are defined as follows:

  • p: The finite field is defined by this prime number.
  • a and b: These are the constants used in the equation.
  • G: The set of all points in the curve is defined by this generator, also known as the base point.
  • n: This represents the order of the base point or generator G, a smallest positive number n such that nG = ∞.
  • h: This is the cofactor, which is the ratio of the orders of the group and sub group (n), and it must be small (h <= 4), usually h=1.
Bitcoin's Elliptical Curve Digital Signature Algorithm
( ECDSA) curve uses a unique set of domain parameters defined in secp256k1. You can find the technical specifications of the curve used in secp256k1 in a later section of this chapter.

The operations performed on an elliptical curve are called dot operations, and they are point addition and point doubling. We will explain both of these operations using a geometrical approach to facilitate a clear understanding. Python scripts and notebooks related to these operations can be found in the GitHub repository for this book:

Figure 2.6: An elliptical graph with co-ordinates and grids (created using www.desmos.com)

We will use the elliptical curve in Figure 2.6 to perform all the operations.