Crypto - Replacement

No one can read my diary! - Gureisya

Challenge

from secret import cal
import hashlib

enc = []
for char in cal:
    x = ord(char)
    x = hashlib.md5(str(x).encode()).hexdigest()
    enc.append(int(x, 16))
        
with open('my_diary_11_8_Wednesday.txt', 'w') as f:
    f.write(str(enc))

Solution

Since the range is limited to ascii characters, we can map each individual hashed character to the encrpyted test and decode it

m=[]
for i in range(256):
    m.append(int(hashlib.md5(str(i).encode()).hexdigest(),16))
for i in c:
    if i in m:
        print(chr(m.index(i)),end="")
#FLAG{13epl4cem3nt}

Last updated