#!/usr/bin/env python3
from Crypto.Util.number import long_to_bytes as ltb, bytes_to_long as btl, getPrime
p = getPrime(1536)
q = getPrime(1024)
n = p*q
e = p
with open("flag.txt", "rb") as f:
PT = f.read()
CT = pow(btl(PT), e, n)
print(f"{len(PT) = }")
print(f"{CT = }")
print(f"{n = }")
I felt that this part was harder than the , yet it had 4 more solves. factordb :(
We are given the length of the plaintext, CT and the modulus. I initially wasted a lot of time thinking its an unbalanced primes question.
From Fermat's Little Theorem, we have
ap=a(modp)
Let
f(x)=x−CT
Then can use coppersmith's theorem to find the roots of the equation mod p
We set the bounds to be 8*len(PT) and beta to be approximately log(n,p)