考点:md5爆破,用python3跑脚本
原理:将原文中问好部分用字母代替,每个都用哈希加密一边,然后审查题目所给元素E903,相同的即为flag。
以下是代码
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import hashlib
#print hashlib.md5(s).hexdigest().upper()
k = 'TASC?O3RJMV?WDJKX?ZM' #要还原的明文
for i in range(26):
temp1 = k.replace('?',str(chr(65+i)),1)
for j in range(26):
temp2 = temp1.replace('?',chr(65+j),1)
for n in range(26):
temp3 = temp2.replace('?',chr(65+n),1)
s = hashlib.md5(temp3.encode('utf8')).hexdigest().upper()#注意大小写
if s[:4] == 'E903': #检查元素
print (s) #输出密文