-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: David Lim <[email protected]>
- Loading branch information
1 parent
c7c2f61
commit 234c9bb
Showing
9 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python3 | ||
from Crypto.Util.number import long_to_bytes | ||
from math import gcd | ||
|
||
a = 1870969079253383528901020811919583012674817901777029440472598207624075857424597551104772657070 | ||
b = 2800712810085008927480330812056676117466496566710583328698036063700356794222073134503996127684 | ||
z1 = 1471692015636458855512725282253417591312312305484809984316224137970424905307644060778134345670 | ||
z2 = 792449287882501111272245107538509962076645267685366076350352640742939177817296346333204609371 | ||
s = 31337 | ||
|
||
f1 = z1 - (a * s + b) | ||
f2 = z2 - (a * (a * s + b) + b) | ||
p = gcd(f1, f2) | ||
print(long_to_bytes(int(p)).decode('latin-1')) | ||
print(p) | ||
|
||
N = 4892859209552999323872659687370348379127745643113821262786525515571537182220986612456469239342928177158573027631641823744589146302682629015019207630171301051593095288921587679376772619467 | ||
e = 65537 | ||
ct = 539412014186375973839103813384645095457567346931432414765860827711741737113352253186058334245660603139758935545076579254418244151719401216900449931898980356125612701132273350239082121055 | ||
q = N // p | ||
assert N == p * q | ||
d = pow(e, -1, (p-1)*(q-1)) | ||
m = pow(ct, d, N) | ||
print(long_to_bytes(m)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
a = 1870969079253383528901020811919583012674817901777029440472598207624075857424597551104772657070 | ||
b = 2800712810085008927480330812056676117466496566710583328698036063700356794222073134503996127684 | ||
f(31337) = 1471692015636458855512725282253417591312312305484809984316224137970424905307644060778134345670 | ||
f(f(31337)) = 792449287882501111272245107538509962076645267685366076350352640742939177817296346333204609371 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python3 | ||
from Crypto.Util.number import bytes_to_long, isPrime | ||
from sympy import * | ||
from secrets import randbelow | ||
|
||
p = nextprime(bytes_to_long(open("msg.txt", "rb").read())) | ||
|
||
a = randbelow(p) | ||
b = randbelow(p) | ||
|
||
def f(s): | ||
return (a * s + b) % p | ||
|
||
print("a = ", a) | ||
print("b = ", b) | ||
print("f(31337) = ", f(31337)) | ||
print("f(f(31337)) = ", f(f(31337))) | ||
|
||
N = 4892859209552999323872659687370348379127745643113821262786525515571537182220986612456469239342928177158573027631641823744589146302682629015019207630171301051593095288921587679376772619467 | ||
e = 65537 | ||
ct = 539412014186375973839103813384645095457567346931432414765860827711741737113352253186058334245660603139758935545076579254418244151719401216900449931898980356125612701132273350239082121055 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
y0u_d0n3_th3_LCG_p4rt_n0w_RSA_c4n_d0n3_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
from Crypto.Util.number import bytes_to_long | ||
from sympy import * | ||
from flag import flag | ||
|
||
2*c**5 - a**3 + b*c = 47769864706750161581152919266942014884728504309791272300873440765010405681123224050402253883248571746202060439521835359010439155922618613520747411963822349374260144229698759495359592287331083229572369186844312169397998958687629858407857496154424105344376591742814310010312178029414792153520127354594349356721 | ||
a**4 + b**5 + a*b*c = 89701863794494741579279495149280970802005356650985500935516314994149482802770873012891936617235883383779949043375656934782512958529863426837860653654512392603575042842591799236152988759047643602681210429449595866940656449163014827637584123867198437888098961323599436457342203222948370386342070941174587735051 | ||
b**6 + 2*c**5 + c*b = 47769864706750161581152919266942014884728504309791272300873440765010405681123224050402253883248571746202060439521835359010439155922618613609786612391835856376321085593999733543104760294208916442207908167085574197779179315081994735796390000652436258333943257231020011932605906567086908226693333446521506911058 | ||
|
||
p = nextprime(a**2 + b**2 + c**2) | ||
q = nextprime(c**2 + b**3 - b*a*c) | ||
|
||
n, e = p*q, 65537 | ||
ct = pow(bytes_to_long(flag), e, n) | ||
print(f'e: {e}') | ||
print(f'ct: {ct}') | ||
|
||
# e: 65537 | ||
# ct: 4316046906387448694144731583157234766331600819923556808382864614844417971639257794673147161731085742779102934848976456829034944708038808598529507690690451513032765586224752163703954497290838332996612354963795612924889454878868394201322418550671489921060228998345872552588042424260966646662860606264792921680555291338063183367842347 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# medium.png | ||
Keep this for tomorrow session. | ||
n:935630460868988262869902212660181832282331648376251 | ||
11831868785021731849937816047251456242519147772494568 | ||
902491239896968507 | ||
p:115627821762881213688249172714598910374461629460339 | ||
76247489177 | ||
q:809174164664013321352242310374654264478223045966119 | ||
3152834291 | ||
|
||
# output.png | ||
(n, e, enc) | ||
9356304608689882628699022126601818322823316483762518686918002882530118318687850217318499378160472514562425191477724945682522667885125161902491239896968507 | ||
65537 | ||
4687209496413444146495130493217522601571018523545866226865359451376720404640132741523654964453050620508388190793827659151414526611259223984961674830223215 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.