Skip to content

Instantly share code, notes, and snippets.

@theoremoon
Created October 11, 2020 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theoremoon/41422711a64f941ca901224526fe513e to your computer and use it in GitHub Desktop.
Save theoremoon/41422711a64f941ca901224526fe513e to your computer and use it in GitHub Desktop.
SECCON 2020 Online CTF - solution for urara
exec(open("output.txt").read())
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
PR.<x> = PolynomialRing(Zmod(n))
f1 = (3*x^2 + a)^2 - 2*x*4*(x^3 + a*x + b) - Q[0]*4*(x^3 + a*x + b)
f2 = (x + t)^65537 - c
r = gcd(f1, f2)
k = inverse_mod(Integer(r[1]), n)
m = -k * r[0]
print(bytes.fromhex(hex(m)[2:]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment