题目:
from secret import flag
#flag全是由小写字母及数字组成
m=md5(flag).hexdigest()
print(flag[:13]+flag[15:18]+flag[19:34]+flag[35:38])
print(m)
# b'LitCTF{md5can3derypt213thoughcrsh}'
# 496603d6953a15846cd7cc476f146771
根据题意需要爆破flag的13 14 18 34 位
故解题脚本如下
import hashlib
from Cryptodome.Util.number import *
'''
from secret import flag
#flag全是由小写字母及数字组成
m=md5(flag).hexdigest()
print(flag[:13]+flag[15:18]+flag[19:34]+flag[35:38])
print(m)
# b'LitCTF{md5can3derypt213thoughcrsh}'
# 496603d6953a15846cd7cc476f146771
'''
m='496603d6953a15846cd7cc476f146771'
#根据题意需要爆破flag的13 14 18 34 位
flag='LitCTF{md5can__3de_rypt213thoughcr_sh}'
table='abcdefghijklmnopqrstuvwxyz0123456789'
for x1 in table:
for x2 in table:
for x3 in table:
for x4 in table:
realflag=flag[:13]+x1+x2+flag[15:18]+x3+flag[19:34]+x4+flag[35:38]
if m == hashlib.md5(realflag.encode()).hexdigest():
print(realflag)
break