ALL the CTFS of Crypto2025 finally
This commit is contained in:
14
crypto-asimmetric/RSA-9/attack.py
Normal file
14
crypto-asimmetric/RSA-9/attack.py
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from Cryptodome.Util.number import bytes_to_long, long_to_bytes,getPrime
|
||||
n = 138728501052719695830997827983870257879591108626209095010716818754108501959050430927220695106906763908822395818876460759364322997020222845247478635848425558793671347756842735011885094468024344931360037542098264527076663690119553302046205282212602106990248442514444587909723612295871002063257141634196430659767
|
||||
c = 40254592670056897412607628206293101688805220813070436291135637864728213056255791064749974976546612178688674369066366922740751516162695397004586912385306024596939610039396946106249406597089442755317018963104229975283670995939592563335766562761230485826833361814955946571348001305529987233069227384314146133493
|
||||
e = 60016485563460433620911462871489753027091796150597697863772440338904706321535832359517415034149374289955681381097544059467926029963755494161141305994584249448583991034102694954139120453335603006006970009433124857766494518747385902016093339683987307620366742481560543776055295663835860818720290861634213881385
|
||||
|
||||
#m=8 in the sage script
|
||||
m = 8
|
||||
d = 130907063345211827271830776605143751868490159532968572514045305424799065327009793
|
||||
pt = pow(c, d, n)
|
||||
decrypted = long_to_bytes(pt).decode()
|
||||
|
||||
print(decrypted)
|
||||
9
crypto-asimmetric/RSA-9/chall.py
Normal file
9
crypto-asimmetric/RSA-9/chall.py
Normal file
@ -0,0 +1,9 @@
|
||||
from Crypto.Util.number import bytes_to_long, getPrime
|
||||
from secret import flag
|
||||
|
||||
p, q = getPrime(512), getPrime(512)
|
||||
n = p*q
|
||||
print(n)
|
||||
e = 60016485563460433620911462871489753027091796150597697863772440338904706321535832359517415034149374289955681381097544059467926029963755494161141305994584249448583991034102694954139120453335603006006970009433124857766494518747385902016093339683987307620366742481560543776055295663835860818720290861634213881385
|
||||
m = bytes_to_long(flag.encode())
|
||||
print(pow(m, e, n))
|
||||
Reference in New Issue
Block a user