pell's_equation
joseph
downunderctf2021
dlp
lll
行列
pell's_equation
pohlig-hellman_attack
sageのdiscrete_logが対応していない群の離散対数問題を解くテク
#joseph #downunderctf2021 def G_add(A, B): x1, y1 = A x2, y2 = B return ((x1*x2 + D*y1*y2) % p, (x1*y2 + x2*y1 + 2*y1*y2) % p) def G_mul(A, k): out = (1, 0) while k > 0: if k & 1: out = G_add(out, A) A = G_add(A, A) k >>= 1 return out def …