XORed
1 minute to read
The program says that someone has used a XOR cipher with a single byte key. This is the output: * 7%8-s70& 61&>
.
Since we know that flags start with ictf{
, we can get the key using "*" ^ "i"
because of XOR cipher properties:
$$ c = m \oplus k \iff k = c \oplus m $$
So we solve the challenge like this:
$ python3 -q
>>> from pwn import xor
>>> c = b'* 7%8-s70& 61&>'
>>> k = xor(c[0], b'i')
>>> m = xor(c, k)
>>> m
b'ictf{n0tsecure}'