Byte Bandits 2020: Crypto - Oldschool

TL;DR Easy challenge, it involves classical ciphers and encoding algorithms.

Problem statement

Part 1: Mr. Boomer recently visited France and encrypted the first part of the flag using something he learned there and put the encrypted data in 3. He said, “The key to figuring out what 3 says can only be found using 1 and 2”.

Part 2: Mr. Boomer encoded the second part of the flag twice, using a different method each time. All he said was that the average was 74.5.

Part 1

We are given two zip files: Part_1.zip and Part_2.zip. Let’s start with decompressing the first one. We get three files called 1, 2 and 3. They are obiously the files the statement was talking about. The first file is the following jpeg image:

Maya

The symbols are Maya numerals. The mayan numbers are a vigesimal (base-20) positional numeral system. More in detail the note says that A = 7 and B = 19.

Let’s see what 2 contains:

Wqv Lvf xp "hnovIvo"

Hmm, it is a short ciphertext. After reading the statement, where the authors mention France, I thought was supposed to deal with something like the Vigenère cipher. However the statement also says that the key to figuring out what 3 says can only be found using 1 and 2, so I guess I have to use the two numbers found in 1 to decrypt 2. I remembered that the Affine Cipher uses two values, usually named a and b, so I decided to give it a try.

The affine cipher

From Wikipedia:

In the affine cipher the letters of an alphabet of size m are first mapped to the integers in the range 0 ... m−1. It then uses modular arithmetic to transform the integer that each plaintext letter corresponds to into another integer that correspond to a ciphertext letter. The encryption function for a single letter is

    E(x) = (ax + b) mod m

where modulus m is the size of the alphabet and a and b are the keys of the cipher. The value a must be chosen such that a and m are coprime. The decryption function is

    D(x) = a^(− 1)(x − b) mod m

where a^(−1) is the modular multiplicative inverse of a modulo m. I.e., it satisfies the equation

    1 = aa^(−1) mod m

Back to the challenge

Decrypting with the affine cipher the ciphertext in the file 2 I obtained the following message:

The Key is "codeRed"

Ok, we have a key and another file to decrypt. The content of 3 is, in fact, another ciphertext:

hzdk{z_whg_mry_

We should try to decrypt it with the previous key, as the statement suggested. Now France come into play since the text is encrypted with the Vigenère cipher.

Giovan Battista Bellaso

As an historical note, I have to say that the guy you see in the picture above is not Vigenère, but the italian cryptologist Giovan Battista Bellaso, who invented the Vigenère cipher in 1553.

Decrypting the ciphertext in 3 using the Vigenère cipher with key codeRed gave me the first part of the flag: flag{i_see_you_.

Part 2

Let’s read again the problem statement, more in detail let’s focus on the second part:

Part 2: Mr. Boomer encoded the second part of the flag twice, using a different method each time. All he said was that the average was 74.5.

Decompressing the Part_2.zip file we get a file called ciphertext with the following content:

Ao(mgHYHi.AS#4oDfoDi=@mg@10QtQ=);qd<C1t51LkZ)12(8p11to8H9u[V7QE8%88E!Q;*@&

If we read the statement carefully we can notice that the word encoded is used in place of encrypted, so it is easy to notice that now we don’t have to deal with ciphers anymore. Moreover they say that two methods have been used and that the average was 74.5, what does it means?

After a little thinking I realized that the two methods refer to two different encoding algorithms and that 74.5 is the average between 64 (I started from this number, because Base64 is the first encoder that came to my mind) and 85, which lead us to Ascii85, also called Base85.

Decoding the encoded text first with Ascii85 and then with Base64 I got the flag: flag{i_see_you_ar3_f@mili@r_w17h_7h3_0ld_w@y$}.

Tags// , ,