# How to find a element in elliptic curve ?(code added)

$Q=G*x$

$Q_2=G_2*y$

$G_2 = Q[n]=G[t]$

$Q=Q2$

$Q$, $G$, $G_2$ are points on elliptic curve.

$x$, $y$ are big integers.

$Q$, $Q_2$, $G$, $G_2$, $y$ are known.

How to find x ?

P.s. help me please. I'm very need help.

Pastebin code copy(more usefull) https://pastebin.com/C2vgKCJ0

CODE:

p = 2 * * 256 - 2 * * 32 - 2 * * 9 - 2^8 - 2^7 - 2^6 - 2^4 - 1

a = 0x0000000000000000000000000000000000000000000000000000000000000000

b = 0x0000000000000000000000000000000000000000000000000000000000000007

F = GF(p)
eccurve = EllipticCurve(F,[a, b])
curve = eccurve
ord = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

Gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798

G = curve(Gx,Gy,1)
# This is a setion with data about Q !!!
# We are not calculating Q and we need find  x and calculate Qz=x*G=Q.
# We are know Q,G but don't know x !!!

Q = curve(0x8b05b0603abd75b0c57489e451f811e1afe54a8715045cdf4888333f3ebc6e8b,
0x1d10f88145db40fb889e2ddce81bda7c27f5b615acd6179dbb30f4fe7f40fb39)

print(Q)

R = Zmod(ord)

####end of section
# this section calculated G2,y and Q = G2*y
x0 = R(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
y = 1/x0

G2 = ZZ( y ) * Q

Q2 = ZZ(x0) * G2

# End of section

# This section after x was find. Find  x and paste to this code:

# x = ....

# Qresult=ZZ (x) * G
# print("Q==Qresult'", Q == Qresult)
# # end of section

print("Q==Q2'", Q2 == Q)

print("Q",Q)

print("Q2",Q2)

print("y",y)

print("G",G)

print("G2",G2)


edit retag close merge delete

Could you please provide the code to construct Q, G, G_2, y ?

I will provide code for construct Q, G, G_2, y shortly. Thank you for your answer Tmonteil !!!Tmonteil I hope for your future help. Br !

Please format sage / python code as code. For this, just indent all the code in some editor with 4 spaces or copy+paste it here, mark it, and while having it marked hit that button with the 101 and 010 on it. As it is, the question is not readable. It would be also a good idea to describe the objects you have first, then the "needed $x$" with given properties. Could you please edit the question to have a readable text?

Sort by » oldest newest most voted

What you are looking for is the discrete logarithm:

sage: x = G.discrete_log(Q) ; x
1155

sage: Q == G * x
True

more