-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathencrypt.py
30 lines (22 loc) · 1.76 KB
/
encrypt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
# all string
FLAG = "1234567890qwertyuiopasdfghjklzxcvbnm! QWERTYUIOPASDFGHJKLZXCVBNM{}_.,"
# encrypted flag: len is 43
enc_flag = [378504, 1040603, 1494654, 1380063, 1876119, 1574468, 1135784, 1168755, 1534215, 866495, 1168755, 1534215, 866495, 1657074, 1040603, 1494654, 1786323, 866495, 1699439, 1040603, 922179, 1236599, 866495, 1040603, 1343210, 980199, 1494654, 1786323, 1417584, 1574468, 1168755, 1380063, 1343210, 866495, 188499, 127550, 178808, 135303, 151739, 127550, 112944, 178808, 1968875]
all = [120099, 127550, 135303, 143364, 151739, 160434, 169455, 178808, 188499, 112944, 1455779, 1699439, 1040603, 1494654, 1574468, 1786323, 1615419, 1168755, 1380063, 1417584, 922179, 1534215, 1010100, 1071714, 1103439, 1135784, 1202358, 1236599, 1271484, 1830854, 1742520, 980199, 1657074, 950894, 1343210, 1307019, 37059, 33824, 538083, 666159, 333339, 558174, 599844, 712979, 621435, 394419, 499359, 518480, 278915, 578759, 319124, 347970, 363023, 378504, 410774, 427575, 444828, 737190, 689304, 305319, 643538, 291918, 480714, 462539, 1876119, 1968875, 866495, 99498, 87164]
enc = []
dec = [''] * 43
for c in FLAG:
v = ord(c)
encrypted = v + pow(v, 2) + pow(v, 3)
enc.append(encrypted)
for i in range(len(enc_flag)):
if enc_flag[i] == encrypted:
dec[i] = c
for i in range(len(dec)): print(dec[i], end="")
print()
# print(enc)
"""
$ python3 encrypt.py
[378504, 1040603, 1494654, 1380063, 1876119, 1574468, 1135784, 1168755, 1534215, 866495, 1168755, 1534215, 866495, 1657074, 1040603, 1494654, 1786323, 866495, 1699439, 1040603, 922179, 1236599, 866495, 1040603, 1343210, 980199, 1494654, 1786323, 1417584, 1574468, 1168755, 1380063, 1343210, 866495, 188499, 127550, 178808, 135303, 151739, 127550, 112944, 178808, 1968875]
"""