Category: Crypto
Points: 50
Description: Mm, coffee. Best served with half and half!

I didn’t really like this challenge but, it was kinda cool. Anyway we are given the following code:

from secret import flag

def xor(x, y):
	o = ''
	for i in range(len(x)):
		o += chr(ord(x[i])^ord(y[i]))
	return o

assert len(flag) % 2 == 0

half = len(flag)//2
milk = flag[:half]
cream = flag[half:]

assert xor(milk, cream) == '\x15\x02\x07\x12\x1e\x100\x01\t\n\x01"'

This reads the flag from another file splits it in half and xor’s it with itself and given the result.

Now since we are looking for the flag it must be in the format act{???} and our resulting text given to us is 12 bytes in length therefore the total length of the flag must be 24 characters long (because half).

So I went into https://gchq.github.io/CyberChef/ and put in the resulting hex value and xor’d it with ‘actf{’ as I knew that, that was the start. This came back with “taste”.

So from here I had the flag as

actf{???????taste??????}

Now because the challeneg kept talking about cookies and milk, I tried them both and “actf{cookies}” gave me tastes_. So now I used tastes and guessed “tastes_good” which gave the other half of the flag.

FLAG:

actf{coffee_tastes_good}

Leave a Reply

Your email address will not be published. Required fields are marked *