The Cipher Challenge

The Cipher Challenge

AngelHack is a global innovation organization, founded on the idea of bringing creators together. Companies from all over the world have chosen them as their partner to engage developers with their technologies through hackathons and events. AngelHack has created an incredibly diverse and global community of change makers and developers

A new challenge was organized giving hints along the way. In this article, we will go step-by-step through the process of solving the challenge

Cipher Text: Jryy qbar lbh! Bar pvcure qbja, ohg vg'f whfg gur ortvaavat.mrvbaevdturheblabarzbhrsbobqkpyqcuztrmbszkkryppstuvtyrykemnkhmbqxzdmzroqkaqqebjvpctlnlhpnluagslymxuxsndjrksshyrduvssaosrwokhcftfnlhxqlc

Let's get right on with it!!

Solving The Challenge

To come to the solution, we have to go over the clues. There were many clues provided, some of which are valuable in getting to the solution and a few others not. We would only go through important ones and leave the rest out. You can find it all on Twitter

Clue 1:

Cryptii is an open-source project for carrying out modular conversion, encoding and encryptions directly on the browser. For starters, we know cryptii is going to be important in solving the puzzle

Clue 2:

CAESAR - Julius Caesar led the Roman army in wars and is a famous name from the roman empire. Caesar Salad is also the name of that depicted in the image. From the hint, we know to use the Caesar Cipher to decrypt the message.

The Caesar Cipher is a method of encryption and decryption with takes a number called KEY and applies this algorithm (shifting) to the letters according to the given key. To know more about it. See Wiki

Now we have the decryption algorithm but not the key... yet... Enter Clue 3

P.S: Without the key, we could iterate by applying keys from 1 to 26 (length of the English alphabet) and we would as well find the key

Clue 3

Image

The image above is a simple math (quantitive reasoning) that multiplies the two top values to get the bottom one i.e 4 x 6 = 24, 8 x 5 = 40. We can deduce the missing number the same way: 1 x 13 = 13. Now we have our key. Back to cryptii

We took the text and applied the Caesar cipher to it and gave it the key of 13 and we get 30% of the problem solved

Current Text: Well done you! One cipher down, but it's just the beginning. zeionriqgheuroynonemouefobodxcldphmgezofmxxelccfghiglelxrzaxuzodkmqzmebdxnddrowicpgyayucayhntfylzkhkfaqwexffuleqhiffnbfejbxupsgsayukdyp

Clue 4:

Another Math problem. We are expected to find the value of 🔺 and 🟢 and ⭐.

Firstly, from row 4, we can deduce that 4⭐ = 20. Hence, A single star ⭐ = 5 (20 ÷ 4)

Equation 1

To find the values of 🔺 and 🟢, we would need to substitute the value of ⭐(5) into other equations gotten from the diagram

Equation 2

From the equation above, we can deduce that 3🟢 + ⭐ = 14. Substituting the value of ⭐(5) in the equation we get 3🟢 = 9. Therefore, the value of 🟢 is 3

Finally, to get the value of 🔺, we put the value of ⭐ and 🟢 into the equation in the diagram above

⭐ + 🟢 + 🔺 + ⭐ = 17. Substituting the values of ⭐(5) and 🟢(3) into the equation

5 + 3 + 🔺 + 5 = 17

🔺 = 4

Therefore, ⭐ and 🟢 and 🔺 = 5 x 3 x 4 = 60.

P.S In mathematics and refers to multiplication (x)

Clue 5:

Yet another basic math problem. This could be solved by using the Pythagoras theorem:

a^2 + b^2 = c^2

Where a and b are the adjacent and opposite sides while c represents the longest side called the hypothenuse . a = 3, b = 4 and c = ⭐

Substituting the values of a, b and c. We get ⭐ = 5. To test the out practically, see this online Pythagoras calculator

Therefore, ⭐= 5

Clue 6:

For the past two clues, we have been solving a lot of math without having to use those values. To recap, in clue 4, we had the value of 60 and in clue 6, we obtained the value of 5.

Looks familiar? This shot is taken from Cryptii. The name of the cipher has been removed so we have to find which of them ourselves. Going through all the algorithms, we would find that the Affine cipher is what we are looking for

The affine cipher involves shifting and scaling letters using two chosen numbers to create an encrypted message, which can be decrypted using the inverse formula.

y=m x+b

Consider the equation above. m represents the slope while b represents the intercept. y and x are the unknowns. This is an example of a formula used to encrypt/decrypt a message in the Affine cipher. Where y and x represent the encrypted and original letters respectively.

Back to solving...

At the moment, we have the slope, and intercept but don't have the alphabets .

By trial, using the entire letters of the English alphabet does not yield anything meaningful yet. Enter Clue 7...

Clue 7:

And for the last part of the affine cipher. We have to supply the letters from the English alphabet we would use.

By default, we would be inclined to use all 26 of them. But from this clue, it says "Remove LEMON From ALPHABET".

Alphabet is the parent company that owns Google (and all their services), Youtube and all the corporations shown below in the image. Removes letters L, E, M, O, N from the English alphabet, we have: abcdfghijkpqrstuvwxyz

Applying Clues 4-7 we finally make some progress in solving the challenge. The current text becomes:

Current Text: Well done you! One cipher down, but it's just the beginning. secondcipherdownonemoretogoxablxqhmpesotmaaelbbtphcpleladskarsoxumismegxanxxdofcbqpwkwrbkwhnvtwlsuhutkifeattrleihcttngteygarqzpzkwruxwq

Now it says "Second cipher down one more to go". And for the last cipher.

Clue 8:

A more straightforward clue. From the image above, we know the 3rd layer would be decrypted by the Bifid Cipher.

The Bifid cipher uses a 5x5 grid to convert each letter of a message into a pair of coordinates, which are then rearranged and converted back into letters to create an encrypted message. Learn more about it Here.

It also makes use of a key to order the arrangement of the letters in the 5x5 grid. From the image above, the key is a 13-letter string containing CIFR somewhere in between.

Bifid Key: ------CIFR---

Clue 9:

Above is an image from the PigPen Cipher . The letters are encrypted from the 3 x 3 grids and give a shape similar to the one in the cipher.

Image from Crypto Corner

From this, using the layout above, we can figure that the text from the cipher would be ANGLHK.

Bifid Key: ANGLHKCIFR---

We have placed the new text at the start of the key because it contains the exact number of letters (6) from that missing position. Now for the last Clue.

Clue 9:

We'll go over the hint above till we get to the 3-letter answer.

  1. "All are correct..". Hence we can deduce that the 3 letters are U, Q and Z. "..one is correctly placed". We'll figure it out as we go.

  2. "Two are correct but are wrongly placed...". We know what those two are already ( U and Q). "...but are wrongly placed". We can deduce that U cannot be placed at the start and Q cannot be placed at the end.

  3. "One is correct and is placed correctly". Now we find the correct position of Q which is the start of the 3-letter sequence.

  4. "One is correct but wrongly placed". From hint 2, we figured U cannot be placed at the start and from this hint we find it cannot also be placed at the end. Hence, U has to be placed in the middle.

Therefore, the sequence becomes Q - U - Z.

This completes the missing letters from the Bifid key.

Bifid Key: ANGLHKCIFRQUZ

Back to Cryptii...

Applying the bifid cipher to the last encrypted text we have ...

WELLDONEYOUHAVECOMPLETEDTHECHALLENGEDMUSTHEENTIREPASSAGEANDWEWILLGIVEYOUYOURPRIZE

Final Solution

After decoding the three layers of encryption, we finally have the solution.

Well done you! One cipher down, but it's just the beginning.

secondcipherdownonemoretogo

welldoneyouhavecompletedthechallengedmusthentirepassageandwewillgiveyouyourprize

Winners

The following twitter handles above were the first five to come up with the solution.

Conclusion

In this article, we went through step-by-step the process of solving a simple cryptography cipher with 3-layer encryption.

Through the way, we learnt about the Caesar cipher, Affine cipher, Bifid cipher, some elementary maths and even a bit about foods (salads). Hopefully, this has given you an idea of how real word code decryption.

To learn more and join more exciting challenges and hackathons, find AngelHack on the following spaces: Twitter, Discord, Official Website, and Other Links.