这个题讲道理应该算作Reverse中的算法题的吧,给定明文密文对求key,然后再根据key来计算flag

写个py脚本逆向一下就好


def get(ch):
	if ch >= '0' and ch <= '9':
		return ord(ch) - ord('0')
	else:
		return ord(ch) - ord('A') + 10

f = open("plain.txt")
str1 = f.readline()
f.close()

f = open("cipher.txt")
str2 = f.readline()
f.close()

t = 0
flag = ''
for i in range(27):
	p = ord(str1[i])
	num = ord(str2[i])
	num = num - i*i - p + t
	while num < 0:
		num += 0x100
	while num > 0x100:
		num -= 0x100
	num = num ^ t
	t = p
	#print chr(num)
	flag += chr(num)
print flag
#print len(flag)
#flag = 'OKIWILLLETYOUKNOWWHATTHEKEZ'
#len(flag) = 27

f = open("flag.txt",'rb')
string = f.read()
f.close()

t = 0
number = ''
for i in range(len(string)):
	num = ord(string[i]) - i*i + t - (ord(flag[i]) ^ t)
	while num > 0x100:
		num -= 0x100
	while num < 0:
		num += 0x100
	number += chr(num)
	t = num
print number