WeChall - Chessy Hawks

Challenge

Chessy Hawks (Crypto, Logic)

Today something weird happened to you. You took a walk in the park and found a USB stick on a chessboard, together with weird numerals on the playfield. You instantly wondered if they are related to each other, and took both the stick and a sketch of the board home. Your thoughts were right. The stick seems encrypted and the chessboard probably reveals the password.

一张 GIF 图片 chessy_hawks.gif,画着一个 8×8 棋盘,某些格子上有 hex 数字。

Solution

棋盘坐标本身可以看作 hex 值:a=0xA, b=0xB, ..., h=0x17。每个有数字的格子上标着一个 hex 值,黄圈正数,蓝圈负数,计算方式为:

1
chr(coordinate_hex - value_on_board)

其中 coordinate_hex = int(str(rank) + file_letter, 16)。

例如 a8:coord = 0x8A = 138,格子上 0x24 = 36。138 − 36 = 102 = 0x66 = f

负值实际做加法(减去负数 = 加绝对值)。例如 f6:coord = 0x6F = 111,格子上 −8,111 − (−8) = 119 = 0x77 = w

所有有数字的格子计算结果如下:

Coord Board Calc Char
a8 (8A) 0x24 0x8A − 0x24 = 0x66 f
e8 (8E) 0x3C 0x8E − 0x3C = 0x52 R
b5 (5B) −0x13 0x5B − (−0x13) = 0x6E n
c6 (6C) 0x49 0x6C − 0x49 = 0x23 # (注)
d6 (6D) 0x1D 0x6D − 0x1D = 0x50 P
f6 (6F) −0x08 0x6F − (−0x08) = 0x77 w
a4 (4A) 0x19 0x4A − 0x19 = 0x31 1
e4 (4E) 0x1B 0x4E − 0x1B = 0x33 3
d2 (2D) −0x2D 0x2D − (−0x2D) = 0x5A Z

注:c6 的值 0x49 对应 #,但它是原始 hex 45 解码环节的一部分。

按坐标顺序 (a8→e8→c6→d6→f6→b5→a4→e4→d2) 读取字符,得到:

1
f R 3 3 P w n 1 3 Z
fR33Pwn13Z