You are on page 1of 3

LAB / TUTORIAL 5: ECC over prime field P

Name: SAW JUNKAI


Matrix ID: B032010067

Instruction: Take your i = 10 + (ID mod 100 or nearest assigned number).


i = 10 + 51
= 61  60

Step 0: My sample number is i=60. I am taking P1(x1, y1) = (1, 2).

Choose a prime number. Let p=257.

1. Choose a random sample a = −4 and b = 7 for the curve

E: y2 = x3 + ax + b

such that 4a3 + 27b2  0 (mod p).


2. Choose a base Point P1(x1, y1) = (xi, yi). Compute P2(x2, y2) = 2P1(x1, y1)
Double Point
Let (x1, y1) be a point on an elliptic curve E(Fp), and (x1, y1)  (x2, –y2)
then let (x2, y2) = 2(x1, y1) such that
2
 3x 2 + a  3x + a
2
x2 =  1  − 2 x1 and y2 = 1
  ( x1 − x2 ) − y1
 2 y1  2 y1

Let slope of the tangent line at (x1, y1) = (1, 2)


3 x1 2 + a ,
c=
2 y1
nume = 312 – 4 = −1  256 (mod 257)
Deno = 22 = 4 – 257  4 (mod 257)
Let us compute an inverse of deno,
4−1  193 (mod 257)
i b= a* q + r u v w = u - vq
0 257 4 64 1 0 1 -64

Then c = 2564−1 = 256193  64 (mod 257).


And c2 = 642  241 (mod 257).
then
x2 = c2 – 2x1 = 241 – 21 = 239,
and
y2 = c (x1 – x2) – y1
= 64(1 – 239) – 2
= −15234  186 (mod 257)

A double point here is P2(x2, y2) = (239, 186).


3. Add Point

To compute P3(x3, y3) = P1(x1, y1)  P2(x2, y2) = (1, 2)  (239, 186).

Let (x1, y1) and (x2, y2) are two points on an elliptic curve E(Fp), and
(x1, y1)  (x2,  y2)
then let (x3, y3) = (x1, y1)(x2, y2) such that
2
y −y  y −y
x3 =  2 1  − ( x1 + x2 ) and y3 = 2 1 ( x1 − x3 ) − y1
 x2 − x1  x2 − x1
Let the slope
y − y1
m= 2 of the line connecting (x1, y1) and (x2, y2)
x2 − x1
then
x3 = m2 – (x1 + x2) and y3 = m(x1 – x3) – y1.

Let us add 2 points, namely, P1(x1, y1) + P2(x2, y2) = (1, 2)  (239, 186).

First, we compute denominator of the slope of secant line,


Nume = 186 – 2 =184.
Deno = x2 – x1 = 239 – 1 = 238.
Second, we need to compute an inverse of the denominator,
(x2 – x1)−1 = 238−1  27 (mod 257).

i b= a* q + r u v w = u - vq
0 257 238 1 19 0 1 -1
1 238 19 12 10 1 -1 13
2 19 10 1 9 -1 13 -14
3 10 9 1 1 13 -14 27

Let us compute the numerator = y2 – y1 = 186 – 2 = 184.


Third, the slope of secant line shall be
y − y1
m= 2 = 18427  4968  85 (mod 257).
x2 − x1
Finally, we can compute the add point,
x3 = m2 – (x1 + x2) = 852 – (1+239)  29 – 240  –211  46 (mod 257).
and
y3 = m(x1 – x3) – y1 = 85(1 – 46) – 2 = 0 – 3827  28 (mod 257)

Final answer is 3(1, 2) = (46, 28).

Additional lesson for this tutorial is 3(1, 2) = 360(1, 2)


= (180-177)(1, 2)
= 3(1, 2)
= (46, 28).

Let us check 2(1, 2) = 260 (1, 2) = (120-118)(1,2) = 2(1,2) = (239, 186).


Let us introduce a basic sum. Given a target sum =199.

Let us compute (1, 2)


i ai Left Right
8 1 (1, 2) (239, 186)
7 1 (46, 28) 4P
6 0 6P 7P
5 0 12P 13P
4 0 24P 25P
3 1 49P 50P
2 1 99P 100P
1 1 199P 200P

You might also like