ångstromCTF 2021: Relatively Simple Algorithm

Relatively Simple Algorithm

Category: Crypto

40 points

RSA strikes strikes again again! Source

Author: lamchcl

Source (rsa.py)

from Crypto.Util.number import getStrongPrime
f = [REDACTED]
m = int.from_bytes(f,'big')
p = getStrongPrime(512)
q = getStrongPrime(512)
n = p*q
e = 65537
d = pow(e,-1,(p-1)*(q-1))
c = pow(m,e,n)
print("n =",n)
print("p =",p)
print("q =",q)
print("e =",e)
print("c =",c)

Output

n = 113138904645172037883970365829067951997230612719077573521906183509830180342554841790268134999423971247602095979484887092205889453631416247856139838680189062511282674134361726455828113825651055263796576482555849771303361415911103661873954509376979834006775895197929252775133737380642752081153063469135950168223
p = 11556895667671057477200219387242513875610589005594481832449286005570409920461121505578566298354611080750154513073654150580136639937876904687126793459819369
q = 9789731420840260962289569924638041579833494812169162102854947552459243338614590024836083625245719375467053459789947717068410632082598060778090631475194567
e = 65537
c = 108644851584756918977851425216398363307810002101894230112870917234519516101802838576315116490794790271121303531868519534061050530562981420826020638383979983010271660175506402389504477695184339442431370630019572693659580322499801215041535132565595864123113626239232420183378765229045037108065155299178074809432

Solution

./RsaCtfTool.py -n 11313890464517203788397036582906795199723061271907757352190618350983018034255484179026813499942397124
760209597948488709220588945363141624785613983868018906251128267413436172645582811382565105526379657648255584977130336141
5911103661873954509376979834006775895197929252775133737380642752081153063469135950168223 -p 1155689566767105747720021938
724251387561058900559448183244928600557040992046112150557856629835461108075015451307365415058013663993787690468712679345
9819369 -q 9789731420840260962289569924638041579833494812169162102854947552459243338614590024836083625245719375467053459
789947717068410632082598060778090631475194567 -e 65537 --uncipher 108644851584756918977851425216398363307810002101894230
112870917234519516101802838576315116490794790271121303531868519534061050530562981420826020638383979983010271660175506402
389504477695184339442431370630019572693659580322499801215041535132565595864123113626239232420183378765229045037108065155
299178074809432
private argument is not set, the private key will not be displayed, even if recovered.

Results for /tmp/tmpd0_p1jc4:

Unciphered data :
HEX : 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000616374667b6f6c645f6275745f7374696c6c5f676f6f645f77656c6c5f61745f6c656173745f756e74696c5f7175616e7475
6d5f636f6d707574696e677d
INT (big endian) : 77829732531886017666421465369706368622254927240332446949265849761777437379574153694975519245766808162
296991738636674224619780544798026515410227980157
INT (little endian) : 88061703563610236827293861387910631235184407060684255250239921424433867451178990271277509511415248
037435547120683547251281518208022599015192064594968868869852975927930713707299622083406207929929552904520884976584976308
120690754751939928170923371232929844023743607981605290539913295411374645437736997756076032
STR : b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00actf{old_but_still_good_well_at_least_until_quantum_computing}'

Flag

actf{old_but_still_good_well_at_least_until_quantum_computing}

Privacy Policy
luc © 2021