feat: finish xiaosai

This commit is contained in:
2023-10-15 19:42:16 +08:00
parent 7fe37b52eb
commit c2de294d1c
13 changed files with 571 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
from Crypto.Util.number import *
p = 170021659067442061523756541191993539248601165314725269340063885026090819928194021233489114706002869522375199940625136026822330472394573193982550217044532146962203411567638298486561460035048451998397915884861905155825573014911356931131393751111816934458614898785910805905358218404703141056982153504282962094549
q = 156289115230564684236869282390677373336412812898135298853785374595122098483952732832928286906302804608150589957073534308140034369315958525768786913022949461790625449368299077456798653080889386800523502656112132648850626018430482876211766660346216029055456596647573751654709671998718949348538504201995353414849
n = p * q
cipher = 15315994859113745140937150782850225701835894977924847828178261709106790713756481438851906169833437205680746393379892960895453635059199072504132009117455118252801524117640663250753749247480223306967637814097656959416506419849108127590869410005001001319682678605925584319221815990695423909010895701674831442387195906671891136861712786777889185580869108974742614564867198257449323144696618681193168712805318310217437715668293800077584570491524233826384775049353844578873853868493454822838612576965182892687235411858595304846022012252673457313575555164210208501163855569260816910756715565420825070869972114502924134935227
phi = (p - 1) * (q - 1)
e = 65537
d = inverse(e, phi)
plaintext = pow(cipher, d, n)
print(long2str(plaintext))

View File

@@ -0,0 +1 @@
flag = b'flag{W0W_you_cAn_factor_2048bits_prime}'

View File

@@ -0,0 +1,19 @@
from flag import flag
from Crypto.Util.number import *
# Is it possible to factor 2048 bits RSA????
p = getStrongPrime(1024)
q = getStrongPrime(1024)
n = p * q
e = 65537
message = bytes_to_long(flag)
cipher = pow(message, e, n)
print(p)
print(q)
print('n = ', n)
print('cipher = ', cipher)
'''
n = 26572534665683235245636883276068606612246011683144885473463339711820331993493357279285848391008791322234296406608539840620252625886064149394162998948970494176467317183311068211754639508369506106626167584042532674048767021259563143175030276397301094824563794971045331643148544039656526615133318494601670688100830427083371422333448416345157657081894568628680132969792458721329931299527818220689347292610785587787837487603664368727957712489422350366840751269348100479824826707549651813948243868760028344290958809882314383956517334878930614926458454637703779278161529934602431923391507121553686269628353968327172758558101
cipher = 15315994859113745140937150782850225701835894977924847828178261709106790713756481438851906169833437205680746393379892960895453635059199072504132009117455118252801524117640663250753749247480223306967637814097656959416506419849108127590869410005001001319682678605925584319221815990695423909010895701674831442387195906671891136861712786777889185580869108974742614564867198257449323144696618681193168712805318310217437715668293800077584570491524233826384775049353844578873853868493454822838612576965182892687235411858595304846022012252673457313575555164210208501163855569260816910756715565420825070869972114502924134935227
'''