ecdlp

CSAW CTF Qualification Round 2019 | Supercurve

#ECDH #ECDLP """ supercurve.py An implementation of a weak elliptic curve over a prime field in standard Weirstrauss form: y^2 = x^3 + ax + b Derived from: https://github.com/andreacorbellini/ecc/blob/master/logs/common.py """ class SuperC…

Pohlig-Hellman Attack

離散対数問題に対するアプローチの一つ。 DLPでもECDLPでも同じアルゴリズムが適用できる。 DLPに対するPohlig-Hellman Attack 前提として、巡回群 の位数 が次のように素因数分解可能であるとする。よくあるのは素数 を法とする乗法群で、その位数はなので…

MOV Attack

ECDLP を準指数時間で解くためのアプローチ 楕円曲線の位数 に対して、 となるような(embedding degree)が小さい時に適用できる。これが成立する典型的な場合が、がsupersingular curveのとき tate pairing (Weil Pairingでも実装できる) p = 133116983089…

HITCON CTF 2022 | Chimera

#HITCON_CTF_2022 import os from Crypto.Util.number import bytes_to_long, getPrime from Crypto.Cipher import AES from Crypto.Util.Padding import pad from hashlib import sha256 from secret import flag p = getPrime(384) q = getPrime(384) n = …

Crypto CTF 2021 | Ecchimera

#cryptoctf2021 #!/usr/bin/env python3 from sage.all import * from flag import flag n = 43216667049953267964807040003094883441902922285265979216983383601881964164181 U = 1823029494546684219302946481817610962847341445869345527252784978012143…

*CTF 2021 | MyCurve

#*CTF_2021 from Crypto.Util.number import bytes_to_long from flag import flag assert flag[:5]=='*CTF{' and flag[-1]=='}' flag=flag[5:-1] def add(P,Q): if Q==0: return P x1,y1=P x2,y2=Q return (d1*(x1+x2)+d2*(x1+y1)*(x2+y2)+(x1+x1^2)*(x2*(y…

PicoCTF 2018 | ECC2

#ECDH #ECDLP #Pohlig-Hellman_Attack Elliptic Curve: y^2 = x^3 + A*x + B mod M M = 93556643250795678718734474880013829509320385402690660619699653921022012489089 A = 660015981440128658766741155702689908063145067111045210367475336127984349047…

Pollard's Rho

DLPやECDLPを解く手法。乱択アルゴリズム [** Pollard's for ECDLP] def pollard_rho(P, Q, G, order): """ Q = xP G: generator """ a, b, x = 0, 0, (1, 0) A, B, X = a, b, x def walk(a, b, x): if x[0] % 3 == 0: return (a*2) % order, (b*2) % order,…

redpwn CTF 2021 | blecc

#redpwnctf2021 #uninterested_challenge_list p = 17459102747413984477 a = 2 b = 3 G = (15579091807671783999, 4313814846862507155) Q = (8859996588597792495, 2628834476186361781) d = ??? Can you help me find `d`? Decode it as a string and wra…

Google CTF 2021 | tiramisu

#googlectf2021 // Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://w…

楕円離散対数問題

ECDLPとも 有限体上ではからを求めることは容易だがその逆は困難, これを求める問題を離散対数問題(DLP)と言った 楕円曲線上では整数と楕円曲線上の点から、楕円曲線上の点を計算するのは簡単だが、その逆は難しい。からを求める問題を#### 楕円離散対数問題…

DEFCON 2020 quals | notbefoooled

ECDLP で、となる(=anomalous curveとなる)ようにを渡すと適当な原始根 を作ってくれるので、こちらからは を送る。すると向こうはSmart Attackでとなるを復元してくる。この攻撃が失敗するようなパラメータとを選べれば勝ち Uninteded solution python2…

ASIS CTF Finals 2022 | monward

#ASIS_CTF_Finals_2022 #!/usr/bin/env sage from Crypto.Util.number import * from secret import C, flag def monon(C, P): a, d, p = C x, y = P return (a*x**2 + y**2 - d*x**2*y**2) % p == 1 def monadd(C, P, Q): a, d, p = C assert monon(C, P) a…