really-secure-application
SRC: https://library.m0unt41n.ch/challenges/really-secure-applicationRSA Crypto chall, we have some values give, so knowing rsa quick maths we can calc the missing pieces and decrypt the flag.
So mainly we know 1 of the primes hardcoded q = 7 and n... n being p * q. So we find q with q = n // p
now we mainly need d, the private key second part.. (n, d)
d ) inverse(e, phi)
phi being p-1 * q-1
Now we can just decrypt using rsa and calced values.
Python:
from Crypto.Util.number import inverse, long_to_bytes
n = 1186029292037952909983792432306452587425266074685148559256411524118533884795954832993947356308189843827916747393770934033391200656633881903962557992375311329821223845429093776689672634207483637282457856395284891548748666784553146529707500135533133296584880911894111872112018935683414189955943902732488471774953
q = 7
p = n // q
#so we have n, n = p * q
#and we know p is prime, so we can calculate d
#e is 65537, so we can calculate d using e and phi
e = 65537
phi = (p-1)*(q-1)
d = inverse(e, phi)
c = 733568336222790589470096969949196690400886881122508612017162580799729948344126319987475331014669434677564792251353760238087218803592587521385878004071493183548939254573853401155722047457350634791379651022516512709399603944845196902930993851922578027579933013748262257897144604228176365756268938687669643000231
m = pow(c, d, n)
flag = long_to_bytes(m)
print(flag.decode())