#!/usr/bin/env python3
import random
import sys
import time

with open("distrib/file", "rb") as f:
    enc = list(f.read())
    time = []
    for i in enc[len(enc) - 18:len(enc)]:
        time.append(i ^ 0x88)
    msg = enc[:len(enc) - 18]

    random.seed(''.join([chr(i) for i in time]))

    key = [random.randrange(256) for _ in msg]
    c = [int(m) ^ int(k) for (m, k) in zip(msg, key + [0x88] * len(time))]

    print(''.join([chr(i) for i in c]))

