## Verticode

Cryptography - 90 Points

Welcome to Verticode, the new method of translating text into vertical codes.

Each verticode has two parts: the color shift and the code.

The code takes the inputted character and translates it into an ASCII code, and then into binary, then puts that into an image in which each black pixel represents a `1` and each white pixel represents a `0`.

For example, A is 65 which is `1000001` in binary, B is 66 which is `1000010`, and C is 67 which is `1000011`, so the corresponding verticode would look like this.

Except, it isn’t that simple.

A color shift is also integrated, which means that the color before each verticode shifts the ASCII code, by adding the number that the color corresponds to, before translating it into binary. In that case, the previous verticode could also look like this.

The table for the color codes is:

``````0 = Red, 1 = Purple, 2 = Blue, 3 = Green, 4 = Yellow, 5 = Orange
``````

This means that a red color shift for the letter A, which is 65 + 0 = 65, would translate into 1000001 in binary; however, a green color shift for the letter A, which is 65 + 3 = 68, would translate into 1000100 in binary.

Given this verticode, read the verticode into text and find the flag.

Note that the flag will not be in the typical `sctf{flag}` format, but will be painfully obvious text. Once you find this text, you will submit it in the `sctf{text}` format. So, if the text you find is `adunnaisawesome`, you will submit it as `sctf{adunnaisawesome}``

### Writeup

I started analyzing the problem step by step.

I wrote a script that can read Black/White Verticode from file.
After that I’ve added the colors shifts and finally I’ve glued all together.

The `parse_bin` and `parse_color` function detect Black/White and Colors Shifts.
In the main cicle the script read the image pixel per pixel (scaled by m=12, because a “block” is 12x12 pixels).
If we are in the first 7 pixel, detect the Color Shift. Otherwise read the “word” in `data`.
When it finish reading the current line apply the color shift to `data` char and append to `key`.

This will print out a nice story about a man named Joe Lopo.
And suddently…

`iamtheflagalllowercasenojoke`