Last week, Google CTF featured a crypto challenge based on the Rubik’s cube. Part of the challenge was to be able to visualize the cube associated to a list of colors, and identify which color was where on the cube. It took me some time to figure out the exact mapping between the list and the 3D structure, and now that the challenge is over I want to share a simple visualization that I made with three.js. Your browser must support WebGL to display it properly!

I also wrote a more complete write-up here.

Below is an interactive form where you can enter cube configurations, with the same serialization as in the challenge. A configuration consists of 54 colors (for the 54 squares of a Rubik’s cube), each of which must be in the set {W, R, G, B, O, Y} (for white, red, green, blue, orange and yellow).

Input must be 54 letters in the set {W, R, G, B, O, Y}

Rotation

Here are some examples of configurations obtained during the challenge.

• The default solved cube
WWWWWWWWWGGGRRRBBBOOOGGGRRRBBBOOOGGGRRRBBBOOOYYYYYYYYY
• The default cube after permutation $U$
OOOOOOGGGGGRWWWOBBYYYGGRWWWOBBYYYGGRWWWOBBYYYBBBRRRRRR
• The default cube after permutation $L$
WWWWWWOOOOOYGGGWRRBBBOOYGGGWRRBBBOOYGGGWRRBBBRRRYYYYYY
• An example of challenger public key $L^{1026} \circ U^{121}$
ORBYOYYGGGGBROWOOYOBYRBGRYWGGYBWYBBRWWGROWROOBRYWRBWWG
• An example of admin public key
GWYROYBBRYGWROGYGBRROGBYBYYRGBWWWOOWRYOWRYBGWGOGWRBBOO