Rainbow in the Dark

Discussion of challenges you have already solved
Post Reply
User avatar
efe
Posts: 45
Joined: Sun Oct 26, 2008 10:28 am
Location: germany

Rainbow in the Dark

Post by efe »

It took me quite a while until I figured out the correct sort sequence of the pixels.
This was very helpful: http://en.wikipedia.org/wiki/HSL_and_HS ... HSL_or_HSV :)

Here is my Python Code:

Code: Select all

import Image

img = Image.open("rainbow.png")
pixel = img.load()

width,height = img.size

def sortkey(x):
	r,g,b = x[0]/255.0, x[1]/255.0, x[2]/255.0
	
	cmax = max ([r,g,b])
	cmin = min ([r,g,b])

	if cmax==r:
		return (g-b)/(cmax-cmin)

	elif cmax==g:
		return 2.0+(b-r)/(cmax-cmin)

	else: # cmax==b
		return 4.0+(r-g)/(cmax-cmin)		


for y in  range(height):
	pixellist = [pixel[x,y] for x in  range(width)]

	pixellist.sort(key=sortkey)
	
	for p,i in map(None,pixellist,range(width)):
		pixel[i,y] = p

img.show()

User avatar
teebee
Posts: 89
Joined: Mon Nov 10, 2008 3:21 pm
Location: Germany

Post by teebee »

This was very helpful for creating the challenge: http://snurl.com/e88zm :-)
User avatar
TheBigBoss
Posts: 29
Joined: Thu Jun 07, 2012 12:07 pm
Location: Germany

Post by TheBigBoss »

Nice to see the intended final image from the Python code above.
I used a technique similar to other challenges. I created four images from the source using different transformations, flipped them if necessary and put them side to side. The result was at least readable.
Redford
Posts: 41
Joined: Sat Jul 04, 2009 8:32 pm
Location: Poland
Contact:

Post by Redford »

Seems like I've found the solution in a similar way to TheBigBoss.

I wanted to test if there's something hidden in the pixels (treated as raw bytes), so I converted the image to BMP and looked at the image using trigram view in Veles (a tool which I'm one of the devs). To my surprise, I found something which looked like letters:

Image

Then I wrote a Python script to extract faces of the cube (only these with letters), merged them in Gimp and recovered the password.

I'm not sure why sorting pixels generated such properties, it's probably something related to how pixels containing FF byte were ordered.

More fancy images below ;)

Image
Image
Image
Image
Post Reply