xct's notes

Searchâ€¦

Red Team

Blue Team

ECC

General

Elliptic Curve Discrete Logarithm Problem (ECDLP) is the problem of finding an integer

`n`

such that `Q = nP`

Common Problems

Find point Q(x,y) such that P +Q = 0

1

#!/usr/bin/env sage

2

â€‹

3

import sys

4

from sage.all import *

5

â€‹

6

# Curve: E: Y2 = X3 + 497 X + 1768, p: 9739

7

# Problem: Find the point Q(x,y) such that P + Q = O.

8

â€‹

9

F = GF(9739)

10

E = EllipticCurve(F, [497, 1768])

11

P = E(8045,6936)

12

â€‹

13

print(P) # P

14

print(-P) # Q

15

print(P+(-P)) # 0 / Point at Infinity

Copied!

Calculate order of composed curve by using "subcurves"

Given p,q,a,b,e we want to find g (requires a prime modulus).

1

E1 = EllipticCurve(GF(p),[a,b])

2

E2 = EllipticCurve(GF(q),[a,b])

3

o1=K1.order()

4

o2=K2.order()

5

d=inverse_mod(e,o1*o2)

Copied!

Getting Curve Parameters from 2 Points

1

a=(A.y**X - A.x**Y - B.y**X + B.x**Y) * inverse_mod(A.x-B.x,n) % n

2

b=(A.y**X - A.x**Y - a*A.x ) % n

Copied!

Last modified 7mo ago

Copy link