on sagemath
-------------------------------
sage:#prime [type:integer] but prime
sage:P = 115792089237316195423570985008687907853269984665640564039457584007908834671663
sage:#Elliptic Curve y2=x3+7 for P [type:curve]
sage:E = EllitpicCurve(GF(P),[0,7])
sage:#Elliptic Curve Order [type:integer]
sage:N = E.order()
sage:#Base Point G [type:point]
sage:G= E(55066263022277343669578718895168534326250603453777594175500187360389116729240,32670510020758816978083085130507043184471273380659243275938904335757337482424)
sage:# "public_key = secret*G" or "public_key = E(pubkey_x,pubkey_y)" [type:point], we know "pubkey_x,pubkey_y"
sage:public_key = E(pubkey_x,pubkey_y)
sage:# "K=random_number*G" [type:point] than "r = K[0]" [type:integer] , you known "r"
sage:K = E.lift_x(r)
sage:#K is_correct ? we don't know
sage:r = your_value #[type:integer]
sage:s = your_value #[type:integer]
sage:z = your_value #[type:integer]
sage:w = 1/s %N
sage:u1 = z * w %N
sage:u2 = r * w %N
sage:#correct "K" point [type:point]
sage:u2*public_key + u1*G #[type:point]
sage:+K == u2*public_key + u1*G #(true or false)
sage:-K == u2*public_key + u1*G #(true or false)
sage r == Integer(+K[0]) #(true or false) [type:integer]
sage r == Integer(-K[0]) #(true or false) [type:integer]
sage:var("k x")
sage:k*s == r*x+z #[type:variable]
sage : K*s == r*public_key + z*G #[type:point] (true or false)
this line type: point
R = E.lift_x(r)
+K and -K are [points], and k is [integer].
in this case
K=(x/s)*PubKey + (z/s)*G
or
K = k*G
k=randint(1,N) #i.e. a random number, you can only try to find this number. it is very difficult in this process.
You can find "k" directly with the values r,s,z
With E.lift_x(R) you get either "+K" or "-K" and this is a "point". However, you cannot find the value "k", which is an integer.