feat: add henri challenge

This commit is contained in:
Abel Stuker 2024-11-25 22:30:18 +01:00
parent 8df415c567
commit 5de7ecdce5
2 changed files with 33 additions and 0 deletions

10
henri/README.md Normal file
View File

@ -0,0 +1,10 @@
# henri
## Text
Just before his death, my good old friend Henri gave me two strange codes.
`3822282633192b59041e3644363a0c`
`2419120d0a0010111c53371f1f11071b10`
He told me he hid a treasure behind a secret door at his airport. One of the codes contains the city and the country of this airport, in the following format: `City:Country`. The only way I can access the secret door is with the hidden flag in the other code. With his final breath, he started the sentence: 'The airport code will ...'. Then he died 😵. And I want the treasure 🤑. Can you help me?
## Files
n/a
## How to Deploy
n/a

23
henri/SOLUTION.md Normal file
View File

@ -0,0 +1,23 @@
## 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}`