The Question

One of the 60-character strings in the provided file has been encrypted by single-character XOR. The challenge is to find it, as that is the flag.

Hint: Always operate on raw bytes, never on encoded strings. Flag must be submitted as UTF8 string.

The Solution

I was able to solve this by doing a simple XOR on each line of the provided file:


import binascii

with open('flags.txt', 'r') as f:
    for line in f:
        line = line.strip()
        x = binascii.unhexlify(line)
        for key in range(256):
            flag = ''.join(chr(b ^ key) for b in x)
            if flag[0:4] == 'dam{':

The flag is dam{antman_EXPANDS_inside_tHaNoS_never_sinGLE_cHaR_xOr_yeet}