# CSE Hex Cube Puzzle

I've been tackling this puzzle named "Hex Cube" from the CSE (Communications Security Establishment, the Canadian "equivalent" of the NSA) which comes with the instructions: "Can you decipher the message? You should be able to if you go back to basics and use a little bit of logic."

Reproduced here in black and white:

         22 5b 61
50 76 6d
77 2a 63
2a 6d 74 70 7c 72 76 76 3f
48 6d 6f 34 77 7a 6a 78 7e
7c 7a 3a 78 78 7e 6f 6a 3a
77 61 2b
75 77 58
6a 76 79
6a 50 66
3f 75 68
6b 75 73


There are 30 different hexadecimal symbols in this 54-symbol message, all in the printable character range of 7-bit ASCII (0x22-0x7f):

      " [ a
P v m
w * c
* m t p | r v v ?
H m o 4 w z j x ~
| z : x x ~ o j :
w a +
u w X
j v y
j P f
? u h
k u s


In response to @JimN's comment, here is the binary representation:

                           00100010 01011011 01100001
01010000 01110110 01101101
01110111 00101010 01100011

00101010 01101101 01110100 01110000 01111100 01110010 01110110 01110110 00111111
01001000 01101101 01101111 00110100 01110111 01111010 01101010 01111000 01111110
01111100 01111010 00111010 01111000 01111000 01111110 01101111 01101010 00111010

01110111 01100001 00101011
01110101 01110111 01011000
01101010 01110110 01111001

01101010 01010000 01100110
00111111 01110101 01101000
01101011 01110101 01110011


This is a Rubik's Cube which can be solved using an online tool in 20 rotations:

R2 U F' U B2 R F' U' D2 R' U L2 U2 D' B2 R2 U' R2 F2 R2

Solved cube:

Shown here in black and white:

         6a 50 63
7a 76 50
22 6a 79
7c 6a 6b 2a 58 66 7a 76 72
76 6d 34 6f 77 2a 7c 78 7a
70 75 6f 2b 68 61 73 48 3a
7e 7e 3f
5b 77 3f
74 61 77
77 78 78
6d 75 75
6a 6d 76


And the corresponding ASCII characters are:

      j P c
z v P
" j y
| j k * X f z v r
v m 4 o w * | x z
p u o + h a s H :
~ ~ ?
[ w ?
t a w
w x x
m u u
j m v


And the binary representation:

                           01101010 01010000 01100011
01111010 01110110 01010000
00100010 01101010 01111001

01111100 01101010 01101011 00101010 01011000 01100110 01111010 01110110 01110010
01110110 01101101 00110100 01101111 01110111 00101010 01111100 01111000 01111010
01110000 01110101 01101111 00101011 01101000 01100001 01110011 01001000 00111010

01111110 01111110 00111111
01011011 01110111 00111111
01110100 01100001 01110111

01110111 01111000 01111000
01101101 01110101 01110101
01101010 01101101 01110110


I figure "back to basics" could refer to "transposition and substitution". Solving the cube would be the transposition part. For the substitution part, I'm thinking "a bit of logic" could mean some bitwise operation.

That's where I'm stuck. I've tried a number of things (e.g. frequency analysis, ASCII shift) to no avail and could use a hint, if anyone has an idea on how to solve this!

2021-04-18 UPDATE: I wonder if there could be a relation between the rotation of the cubelets from the initial to the solved position and some "bit of logic" (bitwise) operations. The cubelet rotations of the solved cube are show below, where: 0: no rotation; 1: 90° rotation; -1: -90° rotation; and 2: 180° rotation.

          0  1 -1
2  0  1
-1  0  0

1 -1  2  0 -1  0   2  2  0
-1  0  2  2  0 -1  -1  0 -1
-1  0 -1  2  1 -1   1 -1  0

2 -1  0
-1  0  2
2  2  2

1  2  2
2  0  2
0  2  2


UPDATE 2021-10-15: Thanks to @fljx for pointing out in the comments that there was a typo in the transcription of the original (scrambled) cube. 6th line, 7th number (yellow of the YRG corner) was incorrectly shown to be 3f - "?". It is now fixed to show 6f - "o" - 01101111.

Also, following @bobble's suggestion, I added this puzzle to the list of bounties with no deadlines, whereby a 600-reputation bounty is offered to anyone who can supply an important hint that allows solving this puzzle. A 200-reputation bounty (the minimum amount) was awarded to @Lukas Rotter.

UPDATE 2021-12-27: I wonder, could the 24-bit RGB color codes, or perhaps 8-bit RGB color codes, be involved in some bitwise operation?

        24-bit  8-bit
RED     FF0000 11100000
GREEN   00FF00 00011100
BLUE    0000FF 00000011
YELLOW  FFFF00 11111100
ORANGE  FF8C00 11101100
WHITE   FFFFFF 11111111


UPDATE 2021-12-28: Here is a French version of this same puzzle. Of the 54 hex symbols, there are 36 different symbols, most within the printable 7-bit ASCII interval, except for 0x7f (DEL) and 6 printable symbols in the extended 8-bit ASCII range, most certainly to account for accented letters in the plaintext.

Also, notice the slight difference in RGB code for the white (gray) squares:

        24-bit  8-bit
WHITE   C0C0C0 10110110


The conversion from 24-bit RGB to 8-bit RGB was done using this formula:

8bit Color = (Red * 7 / 255) << 5 + (Green * 7 / 255) << 2 + (Blue * 3 / 255)

• "Back to basics" could simply be a play on the word "base" as in having to interpret the numbers in base16. Could you also covert the before and before hex symbols into base-2 (binary) and see if a picture emerges in the 0s and 1s ?
– JimN
Commented Sep 7, 2020 at 22:50
• @JimN, I added the before and after binary representation, as suggested. Commented Sep 8, 2020 at 15:35
• "hasH" is very conspicuously present in the solved cube... Commented Apr 4, 2021 at 1:32
• Yes, I had noticed that, but I'm still stumped! Commented Apr 18, 2021 at 11:33
• There's a typo in the transcription of the original (scrambled) cube. 6th line 7th number (Yellow of the YRG corner) should be 6f - "o". It's correct in the solved cube
– fljx
Commented Oct 13, 2021 at 12:34

## 2 Answers

At last, this is solved.

Let's first look at something on the solved cube

The green values are in the 0x40-0x5f ASCII range (where all uppercase letters lie), the orange values in the 0x20-0x3f range (where most punctuation lies), and the rest are all in the 0x60-0x7f range (where all lowercase letters lie.)

If we assume the decrypted version of each cell stays within the same ASCII range, each cell has 32 possibilites. "Use a bit of logic" hints towards a XOR cipher, with values ranging between 0-31 (which makes sure we stay in the same ASCII range).

Unfortunately, the french version does not contain any values within 0x20-0x3f whatsoever, so we cannot just assume most of them are SPACEs, but rather something else is going on...

Face by face...

Repeated values overwhelmingly appear within the same face (e.g. red has 7e, 3f and 77 repeated). So we assume the XOR key is different for each face. I checked all possibilities for each face, and only some of them looked like a realistic possibility given their characters...

Given that, let's just try the following :

Take the first letter of the color name of each face and convert it with A1Z26 -> That's the XOR key for the face

This would also explain why the french version has a gray face rather than a white one: White = Blanche, Blue = Bleu, Gray = Gris -> The creator didn't want two faces to have the same XOR key!

So xor(orange, 15), xor(yellow, 25), etc... results in the following (concatenated by face)
e_luy_-evesrot-ilv-_ahp-,ofmaekomd_-ll-Ie-fseuzzowwhot

Still looks like gibberish

But the fact that most non-lowercase letters turned into either _ and - can hardly be a coincidence... The letter frequency also doesn't look too bad for 54 chars. Looks like another transposition may be needed here.

I was stuck a fair while here, until

I just tried the decryption on the scrambled cube, rather than the solved one :) If we do that, we get

    -If    _yo    u_l    -of ike to-_th -pu solem- zzl ve-    es,    we_    hav        e_a    -wo    rld

From there, we can easily get the final answer:

If you like puzzles, we have a world of them to solve

• Great job :) I think you probably need to move 'to solve' to the end of the message so that no face's contribution is interrupted by another's, but apart from that: well done for persevering!
– Stiv
Commented Oct 18, 2022 at 10:49
• Great work @Lukas Rotter! Finally, I get some closure on this puzzle, some two years later! Commented Oct 29, 2022 at 16:47

For the sake of completeness, applying @lukasrotter's solution to the French puzzle, using the key:

Mapping the first letter of the color using A1Z26, we get: Bleu, 2; Gris, 7; Jaune, 10, Orange, 15; Rouge, 18; Vert, 22. And, yes, this explains why White was changed to Grey, since White is Blanc in French, which would have resulted in two colors starting with the same letter, B, clashing with Bleu, and hence having the same key.

Applying the key:

This can be done using Excel with the following formula: =CHAR(BITXOR(HEX2DEC(square),key)), where square is a cublet value, and key is the above color key.

This results in:

We notice weird characters:

Ã©, Ã‰, Ã€. This is due to UTF-8 encoding of accented characters and correspond to é, É, and À respectively.

Finally, we get the solution:

Si Tu Aimes Les Énigmes_Nous En Avons Tout Un Monde À Résoudre