One True Problem [Crypto]

# One True Problem

Two of my friends were arguing about which CTF category is the best, but they encrypted it because they didn't want anyone to see. Lucky for us, they reused the same key; can you recover it?

Here are the ciphertexts: `213c234c2322282057730b32492e720b35732b2124553d354c22352224237f1826283d7b0651` `3b3b463829225b3632630b542623767f39674431343b353435412223243b7f162028397a103e`

## Recon

The key is probably the flag, we know it starts with `utflag{`. With that we did a plain text attack (xor against the ciphertext) and could figure out the flag/key.

## Code

Code to decode the ciphertext:

```import string

text1 = "213c234c2322282057730b32492e720b35732b2124553d354c22352224237f1826283d7b0651".decode("hex")
text2 = "3b3b463829225b3632630b542623767f39674431343b353435412223243b7f162028397a103e".decode("hex")

flag = "utflag{tw0_tim3_p4ds}"

out1 = ""
out2 = ""
for i in range(len(text1)):
out1 += chr(ord(flag[i %len(flag)]) ^ ord(text1[i]))
out2 += chr(ord(flag[i %len(flag)]) ^ ord(text2[i]))

print flag
print out1
print out2
```

Running it:

```utflag{tw0_tim3_p4ds}
THE BEST CTF CATEGORY IS CRYPTOGRAPHY!
NO THE BEST ONE IS BINARY EXPLOITATION
```

## Flag

`utflag{tw0_tim3_p4ds}`