It's not cryptographically secure random, but I think it's good enough.
nc semantic.ecsc24.hack.cert.pl 5102
import binascii import random def xor(*t): from functools import reduce from operator import xor return [reduce(xor, x, 0) for x in zip(*t)] def main(): flag = open("flag.txt", 'rb').read() while True: print("1. Get ciphertext") print("2. Exit") choice = input(">").strip() if choice == "1": keystream = [random.randrange(0, 255) for _ in range(len(flag))] random.shuffle(keystream) print(binascii.hexlify(bytes(xor(flag, keystream))).decode()) elif choice == "2": return else: print("WTF?") if __name__ == "__main__": main()
Format flagi:
ecsc24{litery_cyfry_i_znaki_specjalne}
.
W razie wątpliwości lub pytań dotyczących konkursu zapraszamy na naszego Discorda: https://discord.gg/gAtRKa2rcn.