Maojui

Seccon 2017 - Simon ... (Crypto, 100)

2017-12-11

1
Simon_96_64, ECB, key="SECCON{xxxx}", plain=0x6d564d37426e6e71, cipher=0xbb5d12ba422834b5 

I found Simon algorithm at : https://github.com/inmcm/Simon_Speck_Ciphers/blob/master/Python/simon.py

Brute Force :

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
from simon import SimonCipher
from libnum import *

plaintxt = 0x6d564d37426e6e71
ciphertxt = 0xbb5d12ba422834b5
block_size = 64
key_size = 96

S = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefgihjklmnopqrstuvwxyz0123456789_'

for a in S[-5:] :
for b in S :
print(a+b+"..")
for c in S :
for d in S :
key = s2n('SECCON{%s}' % str(a+b+c+d))
if a+b+c+d == 'FLAG' :
print(key)

cryp = SimonCipher(key, key_size, block_size, 'ECB')
if plaintxt == cryp.decrypt(ciphertxt) :
print("?????")
print(a+b+c+d)
exit(1)

key == "SECCON{6Pz0}"

SECCON{6Pz0}