The flag is in the last line. It is xored with KEY1, KEY2 and KEY3. Thus, all we need to do is to xor that line with all these keys. Lines 1 and 3 contains those combinations.
That is, KEY1 ^ KEY2 ^ KEY3 ^ FLAG ^ KEY1 ^ KEY3 ^ KEY2 = FLAG
For the next few challenges, you'll use what you've just learned to solve some more XOR puzzles.
I've hidden some data using XOR with a single byte, but that byte is a secret. Don't forget to decode from hex first.
73626960647f6b206821204f21254f7d694f7624662065622127234f726927756d"
We know that the flag starts with 'c' as it follows the format crypto{flag}.
So, to find the one byte key we can xor the first byte of the string with the int value of 'c'.
#!/usr/bin/env python3
from pwnlib.util.fiddling import xor
s = bytes.fromhex('73626960647f6b206821204f21254f7d694f7624662065622127234f726927756d')
key = s[0] ^ ord('c')
print(xor(s, key))
You either know, XOR you don't
"I've encrypted the flag with my secret key, you'll never be able to guess it.
0e0b213f26041e480b26217f27342e175d0e070a3c5b103e2526217f27342e175d0e077e263451150104"
This challenge is similar to the previous one. We start with the fact that we know the flag start like this crypto{.
#!/usr/bin/env python3
from pwnlib.util.fiddling import xor
s = bytes.fromhex('0e0b213f26041e480b26217f27342e175d0e070a3c5b103e2526217f27342e175d0e077e263451150104')
known_plain_txt = 'crypto{'
print(xor(s, known_plain_txt))
# Outputs: b'myXORke+y_Q\x0bHOMe$~seG8bGURN\x04DFWg)a|\x1dTM!an\x7f'
# From this we derive the key
key = 'myXORkey'
print(xor(s, key))