Cyber Sea Game 2017: addcrypto (50)
Wed 29 November 2017 ·
< 1 min read
We are given a file, encrypt.py
, which looks as follows.
import os
from flag import flag
message = os.urandom(8) + flag
cipher = ''
for i in range(0, len(message) - 1):
cipher += chr((ord(message[i]) + ord(message[i+1]) + ord(message[i+1])) & 0xff)
print cipher.encode('hex')
# 4c8f7236c7b259b4e9b792929f2d59534437394530392a2547645958522d3d3b4e3e412c2f2a47314b604d483849342534413e516673 …