Tags: scripting crypto image

Rating:

After looking at files it was obvious that problem depends on solving sudoku in sudoku.png.
First an online sudoku solver like: http://www.sudoku-solutions.com/

The name of file "row-major-order" tell us that we must change order of pieces of image relate to solved sudoku.
Doing this process with hand was frustrating so using a quick python script will help:

<span>runme.py:
import Image
image = Image.open("image.png")result = Image.open("image.png")
def move(row1, col1, row2, col2):
</span>    xsize, ysize = image.size
delta_x = xsize / 9
<span>    delta_y = ysize / 9
<span>    part1 = image.crop(((col1 - 1)*delta_x, (row1 - 1)*delta_y, col1*delta_x, row1*delta_y))
result.paste(part1, ((col2 - 1)*delta_x, (row2 - 1)*delta_y, col2*delta_x, row2*delta_y))
<span>
def correct_row(list, row):
i = 1
<span>    for l in list:
</span>        move(row, i, row, l)
<span>        i += 1

<span>correct_row([9,6,4,1,2,7,5,3,8], 1)
correct_row([7,1,2,3,8,5,6,9,4], 2)
correct_row([3,8,5,4,9,6,7,1,2], 3)

correct_row([4,9,1,5,7,8,2,6,3], 4)
correct_row([2,3,8,6,1,4,9,7,5], 5)
correct_row([5,7,6,2,3,9,8,4,1], 6)

image.show()
result.show()
</span></span></span></span></span>