write-ups-challenges-2024-2025/henri/SOLUTION.md
2024-11-25 22:30:18 +01:00

1.6 KiB

Difficulty

??

Category

Cryptography

How To Solve

First you need to look up what airport we are talking about. A quick Google search should lead you to the Henri Coanda International Airport in Bucharest, Romania. We now know that one of the two codes is an encryption of Bucharest:Romania. The Airport Code of the Henri Coanda International Airport is OTP, referring to the One-Time Pad encryption technique. This is a safe encryption technique, as long as the encryption key is only used one single time. In this case, both messages (m_{1}= Bucharest:Romania and m_{2}= the flag ) were encrypted using the same key k. This is where OTP becomes crackable.

Encryption of both messages:

c_1 = m_1 \oplus k
c_2 = m_2 \oplus k

The two codes that Henri gave me are c_1 and c_2 in this case. Since the same key was used twice, we get c_1 \oplus c_2 = (m_1 \oplus k) \oplus (m_2 \oplus k). Due to the associativity of XOR we can remove the parenthesis, and due to its commutativitiy, we can rewrite as m_1 \oplus m_2 \oplus k \oplus k. Since k \oplus k = 0, we now know that c_1 \oplus c_2 = m_1 \oplus m_2.

In this case, we already know m_1. We can now easily calculate m_2, which is the flag, using c_1, c_2, and m_1:

m_1 \oplus (c_1 \oplus c_2) = m_1 \oplus (m_1 \oplus m_2)
m_1 \oplus c_1 \oplus c_2 = (m_1 \oplus m_1) \oplus m_2
m_1 \oplus c_1 \oplus c_2 = m_2

You can write your own script or use a tool like cribdrag to perform these calculations. Even easier is to use an online tool to solve it: http://cribdrag.com.

Flag

IGCTF{C0anD4_H}