# Convert secp256k1 G point to twist sextic curve

I need to convert point from one curve to another twist curve of previous curve.

from sage.all import *

p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f
K = GF(p)
a = K(0x0000000000000000000000000000000000000000000000000000000000000000)
b = K(0x0000000000000000000000000000000000000000000000000000000000000007)
E = EllipticCurve(K, (a, b))
G = E(0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798, 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8)

D = K(2)

W = E.sextic_twist(D)

# Convert secp256k1 G point to sextic twist curve

edit retag close merge delete

Sort by » oldest newest most voted

E and W are not isomorphic over K, so to map the point you need to first extend scalars to a field where the curves become isomorphic.

In this case that field is K[x]/(x³ - 2), so you may do:

sage: R.<x> = K[]
sage: Kext.<z> = K.extension(x**3 - D)
sage: iso = E.change_ring(Kext).isomorphism_to(W.change_ring(Kext))
sage: iso(G)
(40216402057367404040950003906398818325277679584028406643169464361823622385192*x : 43475077929003398730357028969543559394773055995479050704508650707585105896924 : 1)


Note that in principle you could try to construct Kext as K.extension(3), but that takes forever because Sage spends an insane amount of time looking for a special irreducible polynomial, so better provide the polynomial yourself.

more