Hello! , this will be the sequel of:

Elliptic Curve Crypto , The Basics

Today let’s try to tackle operations as in addition and multiplication , keep in mind that these are “invented” operations , the fact that it is called addition it’s a mere coincidence , They should’ve been called something different but such is life.

I will split this into a few concepts and then lately write about some of the exceptions.

The Slope

The Slope is calculated between two points , and it’s got it’s own formulas for it , depending on the location of P and Q (two points on the curve).

So let’s see these formulas:

image

Slope is also called λ (lambda) , but i think slope makes more sense to me .

The Slope is calculated differently if P = Q, let’s look at that example:

image

Alright so that’s pretty simple , S or λ , are crucial to then do point doubling and point addition.

Point Addition:

So this is one of the most basic elliptic curve operations , and remember that when we say addition we’re not talking about addition as 1+1 , it’s a different kind of operation that follows and algorithm as well.

So let’s look at the formula or mathematical identity , it goes like:

image

R would be the third point in question , the result of “adding” P and Q:

RX = S ** 2 - QX - PX  
RY = -( QY + S * ( RX - QX))

If you’re paying attention , you noticed in the graph above that the resultant of the addition it’s called -R , and that is cause R, the result we want , is the reflection over the X axis of -R , in such way:

image

Below is a small code sample of how this should work :

That’s all for today , there’s still one very important operation called point doubling that we need to look at , probably in the next article.

There has been a few questions about exceptions , situations where a line would cross two points but not a third one , defeating the rule we spoke in the first article:

image

You can see that neither of these possibilities will cross a third point , we will cover all these in the next article , but if you can’t wait check “the group law” in wikipedia :)

Thanks a lot for the tons of reads this is getting and also the comments!