Singular curve: hidden easy problem
Not every y² = x³ + a·x + b equation is an elliptic curve. For this, the discriminant must not be equal to zero:
D = 4*a^3 + 27*b^2 != 0 (mod p)
If D = 0, the curve is called singular — it has a self-intersecting point (node) or a sharp point (cusp). The smooth points of such a «curve» still form a group, and the usual addition/doubling formulas work, but this group is not elliptic — it becomes isomorphic to an ordinary, very easy group.
In particular, when a = b = 0, a cusp is formed at y² = x³. In this case, the following mapping maps the smooth points to (Fp, +) — that is, to the ordinary additive group:
phi(x, y) = x / y (mod p)
That is, phi(P + Q) = phi(P) + phi(Q). Therefore, if Q = k·G, then phi(Q) = k · phi(G), and k is found by a single modular division — no BSGS or brute-force is needed.
Below is a «curve» over a 320-bit p. Find the scalar k, then convert it to big-endian bytes and read it — the flag is there.
p = 1971183980670477425391884405590068131689578845912241552560204915150694061595091507232402179974827
a = 0
b = 0
G_x = 849900109921225525049126739971494439338756658155075940263201923050113327728216042148384673701211
G_y = 16527217120780377032197468272655941372944571822910187295220489852169697761139648725135522331057
Q_x = 666912357548542610393424569177089856203928654943393562101703245576274223414225128282579739683338
Q_y = 879260727123031201465716064105965443638085242643183755512221957761238548537057047993412097952846
Converting to bytes: k.to_bytes((k.bit_length()+7)//8, 'big')