Monday, October 18

# public key from non-public key math

0
20 Please information me if following is the precise math to drive public key from a non-public key then how would this apply to generate public key from non-public key 1 please information me step-by-step

Non-public keys and public keys
With these formalities out of the best way, we are actually ready to know non-public and public keys and the way they’re associated. Right here it’s in a nutshell: In ECDSA, the non-public secret’s an unpredictably chosen quantity between 1 and the order. The general public secret’s derived from the non-public key by scalar multiplication of the bottom level quite a lot of instances equal to the worth of the non-public key. Expressed as an equation:

public key = non-public key * base level

This exhibits that the utmost attainable variety of non-public keys (and thus bitcoin addresses) is the same as the order.

In a steady discipline we may plot the tangent line and pinpoint the general public key on the graph, however there are some equations that accomplish the identical factor within the context of finite fields. Level addition of p + q to seek out r is outlined component-wise as follows:

c = (qy – py) / (qx – px)
rx = c2 – px – qx
ry = c (px – rx) – py

And level doubling of p to seek out r is as follows:

c = (3px2 + a) / 2py
rx = c2 – 2px
ry = c (px – rx) – py

In follow, computation of the general public secret’s damaged down into quite a lot of level doubling and level addition operations ranging from the bottom level.

Let’s run a again of the envelope instance utilizing small numbers, to get an instinct about how the keys are constructed and utilized in signing and verifying. The parameters we’ll use are:

Equation: y2 = x3 + 7 (which is to say, a = 0 and b = 7)
Prime Modulo: 67
Base Level: (2, 22)
Order: 79
Non-public key: 2

First, let’s discover the general public key. Since now we have chosen the best attainable non-public key with worth = 2, it’ll require solely a single level doubling operation from the bottom level. The calculation appears to be like like this:

c = (3 * 22 + 0) / (2 * 22) mod 67
c = (3 * 4) / (44) mod 67
c = 12 / 44 mod 67

Right here now we have to pause for a little bit of sleight-of-hand: how can we carry out division within the context of a finite discipline, the place the end result should at all times be an integer? Now we have to multiply by the inverse, which area doesn’t allow us to outline right here (we refer you to right here and right here if ). Within the case at hand, you’ll have to belief us for the second that:

44-1 = 32

Transferring proper alongside:

c = 12 * 32 mod 67
c = 384 mod 67
c = 49

rx = (492 – 2 * 2) mod 67
rx = (2401 – 4) mod 67
rx = 2397 mod 67
rx = 52

ry = (49 * (2 – 52) – 22) mod 67
ry = (49 * (-50) – 22) mod 67
ry = (-2450 – 22) mod 67
ry = -2472 mod 67
ry = 7

Our public key thus corresponds to the purpose (52, 7). All that work for a non-public key of two!