题目描述
题目为一个 crypto.zip的压缩包,解压后得到 python 文件及加密后的文本文件
代码分析
ciphertext
中的字符串如下,长度为 56
cb20dc31e87acbcbf3e2191aa3f3a99219701a52d11a6adcd12624af
分析 Python 文件的加密算法,找到生成 ciphertext
的代码块
ciphertext = ''
for each in flag:
for i in range(0,len(key)/2):
# ord() 返回一个字符十进制的 ascii 码值
temp = (ord(key[i \* 2]) \* ord(each) + ord(key[ i\*2 + 1])) % 251
ciphertext += '%02x' % temp
分析 ciphertext 的生成过程
ciphertext
通过追加 temp
得到,每次取 temp
的前两位并转换为16进制,并且 ciphertext
赋值的部分没有写在