Compare truncated MD5 authentication - supplement

Following Part MD5 verification article comparing truncated after a friend suggested that in addition to digital, many alphanumeric plaintext after the MD5 encryption can also achieve the same effect

Encountered while another more specific truncation in comparison verification De1CTF Web4 title, as shown:

The tips of the red box, this means that prompts verification plaintext (Code) + random string (fTyHgZII) before six equal b77333 taken after encryption md5

In this case the first chapter alone digital blasting script would be difficult to blast a truly Code, a friend gave me a blast to share the following script:

 1 import hashlib
 2 
 3 addStr = 'TSw8BK8m'
 4 knownMd5 = 'd3b6da'
 5 
 6 dict = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 7 
 8 def md5(text):
 9     return hashlib.md5(str(text).encode('utf-8')).hexdigest()
10 
11 for i in dict:
12   for j in dict:
13       for k in dict:
14           for l in dict:
15             x = i + k + j + l
16             b = x + addStr
17             codeMd5 = md5(b)
18             if codeMd5[:6] == knownMd5:
19                 print(x)

Run results shown in Figure:

 

Guess you like

Origin www.cnblogs.com/icecoke/p/11300841.html