丢失的MD5
源代码:
import hashlib
for i in range(32,127):
for j in range(32,127):
for k in range(32,127):
m=hashlib.md5()
m.update('TASC'+chr(i)+'O3RJMV'+chr(j)+'WDJKX'+chr(k)+'ZM')
des=m.hexdigest()
if 'e9032' in des and 'da' in des and '911513' in des:
print des
发现给的代码不全,这里我们给补全
因为代码遵循MD5算法,也就是说在哈希之前必须对Unicode对象进行编码
具体做法就是在"update"函数之中所有的所有参数进行可选参数编码,默认编码为'utf-8'
import hashlib
for i in range(32,127):
for j in range(32,127):
for k in range(32,127):
m=hashlib.md5()
m.update('TASC'.encode("utf-8")+chr(i).encode("utf-8")+'O3RJMV'.encode("utf-8")+chr(j).encode("utf-8")+'WDJKX'.encode("utf-8")+chr(k).encode("utf-8")+'ZM'.encode("utf-8"))
des=m.hexdigest()
if 'e9032' in des and 'da' in des and '911513' in des:
print(des)
flag{e9032994dabac08080091151380478a2}