Elliptic Curves And Web-3 (Part-2)

Ahmet Göker
4 min readApr 26, 2024

--

Hello everyone! Today I will introduce the ECC algorithm from a mathematical perspective. In my previous blog, I wrote about the relationship between ECC and WEB-3 technology. I will now discuss ECC from a mathematical perspective.

In my previous blog posts, I discussed the relationship between web-3 and ECC and the importance of their integration. In this blog, I will focus on the security of ECC and its impact on blockchain wallets, especially in the context of cryptocurrencies. I think it is important for everyone to consider the safety of their actions. I will explain it briefly so that everyone understands it clearly

Blockchain wallet and ECC

ECC forms the backbone of secure transactions in blockchain wallets. This is like a collaboration between your wallet and the blockchain network just to ensure the permission work.

In mathematics, an elliptic curve is a planar algebraic curve containing all points {x,y} and is defined by the following equation:

Cryptography uses a simple form of the elliptic curve; this means:

The Graph:

ECC uses elliptic curves defined in the finite field Fp where p is prime and greater than 3) or F2m where the field size is expressed as p = 2m. In this case, the field is represented as a square matrix of dimensions p x p, which delimits the curve points to integer coordinated in the field. All mathematical operations such as addition and multiplication under this name create another point with the same name. The equation of the elliptic curve over a finite field Fp is expressed in modular form:

RSA uses integers in the range 0......p-1 (Zp field) as the key, while ECC uses {x,y} in the galois field Fp; where x and y are the same in the range 0....p-1

Private, public key in ECC

In ECC, when we multiply a fixed EC point G (design point) by a certain integer k (which can be considered as the private key), we get the EC point P, which becomes the public key. In ECC we use:

  • Elliptic curve (EC) over a finite field Fp
  • G as the generator point (a fixed constant and base point on the EC)
  • k as the private key (an integer)
  • P as the public key (a point on the curve)

Using the established ECC multiplication algorithm, P= k * G is calculated very quickly as the Double addition algorithm, it works in logarithmic time log2(k), even with a 256-bit curve this requires only a few hundred EC operations.

It is surely extremely slow (considered infeasible for large k) to calculate k = P / G

Diffie-Hellman Key Exchange Example

The key exchange using elliptic gradients can be done as followsLet p be a prime number p of approximately 2 over 180 and choose parameters a and b using the elliptic equation. This group of elliptic points forms Ep(a,b). Then choose the starting point G = (x1, y1) in Ep(a,b). The most important condition for choosing G is that the smallest value of n that satisfies the equation n*G = 0 must be a very large prime number. Now Ep(a,b) and G are known to all participants in the cryptosystem. The key exchange between a user A and a user B takes place as follows:

  1. A selects an integer Na less than n. This is A’s private key. Then A generates its own public key which is a point of Ep(a,b) by calculating Pa = Na * G
  2. B creates its own public key Pb by the same method
  3. A’s secret key K=Na*Pb and B’s secret key K=Nb*Pa
  4. The result of the two calculations in the third step is the same. Because Na*Pb = Na(Nb*G) = Na(Nb*G) = Nb(Na*G) = Nb*Pa, this method can be used by an attacker who wants to carry out an attack. Based on the given G and K*G values, he will want to calculate the k value, which is very difficult. If I want to give an example about this:

A’s private key Na=121 and in this case this user’s public key Pa=121 * (2,2) =(115,48). B’s private key Nb = 203 and in this case this user’s public key Pb = 203*(2,2) = (130,203)

If this key is to be used as a session key for traditional encryption, only one number needs to be generated. Basically we can use either the x coordinate or the y coordinate as the key.

Summary

In this blog, I demonstrated ECC cryptography from a mathematical perspective, explaining how it works. We will later delve into more advanced concepts and provide coding examples. Thanks for reading!

You can follow me on:

LinkedIn: https://www.linkedin.com/in/ahmetgoker/

Twitter: https://twitter.com/lockpin010_

--

--

Ahmet Göker
Ahmet Göker

Written by Ahmet Göker

Full stack Reverser | C-ASM | Security

No responses yet