-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathchall.py
23 lines (20 loc) · 1 KB
/
chall.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from Crypto.Util.number import getPrime, isPrime, bytes_to_long
import random
sub = list(range(10))
random.shuffle(sub)
print(sub)
while True:
p = getPrime(512)
q = int("".join([str(sub[int(x)]) for x in str(p)]))
if isPrime(q):
break
n = p * q
print(n)
flag = open("flag.txt").read().strip()
c = pow(bytes_to_long(flag.encode()), 65537, n)
print(c)
"""
[3, 6, 4, 9, 7, 2, 5, 1, 8, 0]
1662734555680236560371530079840156165546159265240770476500812347981852655169775541583485319519878094053069884955030546649262293926078756102019959180326054221460930099440022824663595600039215393680689814825169197892296923928206875142345683514271717622975714505083061478942950252402251867438452387340862290137
241399194708316849608755356927720261591621893028896545057379764987808799982407143230391832194682326766363130949099792388236883286010161112639301567814765709251906638177634992085563885680955748573936682405066095486745438557057546189346859435921430625592425570072427485376830305340441748182623861850285101476
"""