# A row of two-colored circles

One day, as you go to work, you find a string with some two-colored circles glued to it:

At once you remember that a mysterious man, who you met on the previous day, had told you that he will send some secret message to you...

Can you decrypt the secret message? (no keys used)

Hint 1:

This is how the word "encripted" looks:

Hint 2:

This is how the word "describe" looks:

(All images were made with canvas, a module for node.js)

• Can you clarify if hint 1 is "encrypted" or "encripted"? Commented Apr 20, 2015 at 16:08
• Apparently, the "ri" from "encripted" and "describe" are encoded the same way, but the "c" in front of them is not. So the encoding of one character seems to depend on the character in front of it, but nothing else. However, red/red then belongs to p->t, e->d, and d->e, and I have no idea how these relate to each other. Also, red/yellow belongs to i->p as well as t->e. Commented Apr 21, 2015 at 10:07
• The colors probably encode bits by their RGB values. For example, white/blue would be 111/001. Commented Apr 21, 2015 at 10:09
• Is the right half of the left-most ball always white, cyan, blue or purple? Commented Apr 21, 2015 at 19:48
• Using RGB as binary (255=1, 0=0) I get some patterns, but I can't figure out how to apply them. I thought maybe coordinates to a number pad, or a telephone keypad, but I'm stuck. Commented Apr 22, 2015 at 11:55

The solution is

good job

The circles are read from left to right and the binary RGB values of each half encode three bits:

| colour | R | G | B |
-----------------------
| black  | 0 | 0 | 0 |
| blue   | 0 | 0 | 1 |
| green  | 0 | 1 | 0 |
| cyan   | 0 | 1 | 1 |
| red    | 1 | 0 | 0 |
| purple | 1 | 0 | 1 |
| yellow | 1 | 1 | 0 |
| white  | 1 | 1 | 1 |


Even if each circle can encode 6 bits and values from 0 to 63, it seams as if only the values 0 to 31 are actually used. The binary digits are read as BGR, starting with the right half of the circle. Let us define the value of each circle n like this:

$C_{n} = (G_{R}R_{R}B_{L}G_{L}R_{L})_{2}$

The value of the blue bit in the right half contains both values 0 and 1 in the examples, but the value seem to be irrelevant for the decoding process.

Now, starting with $L_{0} = 0$, the letters for $n \ge 1$ can be decoded with:

$L_{n} = C_{n} - L_{n-1} \quad \text{ if } \quad C_{n} \ge L_{n-1}$

$L_{n} = C_{n} - L_{n-1} + 27 \quad \text{ if } \quad C_{n} \lt L_{n-1}$

A value of 0 encodes a space and the values 1 to 26 the letters A to Z.

• Good job! You've found it. Here is the source code (for node.js): Github Gist Commented Apr 22, 2015 at 15:41
• @BojidarMarinov Does the value of the 'blue bit' of the right half circle has a meaning, or is it just filled with random values? As I already wrote, it does not seem to be significant for the decoding process. Commented Apr 22, 2015 at 16:46
• Sorry, I just checked the code. You are simply repeating the blue bit from the left half circle in the right half? Commented Apr 22, 2015 at 16:48
• yep I do just that :) Commented Apr 22, 2015 at 17:59