๐ฎ๐ฉTEDCTF
participated as insidious_hex, got into the final stage
Cryptography
RSAPonent (356 pts)
# dari rsaponentmod.py
def GCZ_x(md, exp):
return md * ((((1 << exp) - (1 << (exp - 1))) // ((1 << (exp - 2)) - (1 << (exp - 3)))) ** ( ((((1 << exp) - (1 << (exp - 1))) // ((1 << (exp - 2)) - (1 << (exp - 3)))) ** (((1 << exp) - (1 << (exp - 1))) // ((1 << (exp - 2)) - (1 << (exp - 3))))) ** ((((1 << exp) - (1 << (exp - 1))) // ((1 << (exp - 2)) - (1 << (exp - 3)))) >> 1)))from math import gcd
from Crypto.Util.number import *
# c, pmod, qmod ambil dari output.txt. Google docs gakuat load angkanya :v
common = gcd(pmod,qmod)
def GCZ_reverse(md, com):
return md // com
p = GCZ_reverse(pmod,common)
q = GCZ_reverse(qmod,common)
n = p*q
e = 65537
phi = (p-1) * (q-1)
d = pow(e,-1,phi)
m = pow(c,d,n)
print(long_to_bytes(m))wrth (400 pts)
Last updated