Ich habe dir einen Beispiel-Code für das Bruteforce eines 4-stelligen-Passworts geschrieben:
import hashlib
# targetpw = "dbd2bf69993e05f2775989a5939586be"
targetpw = "51c48f147d4f4a3773cbbd690ae99a84" # is "abcd"
def md5(password, constant):
m = hashlib.md5()
m.update(str.encode(password + constant))
return m.hexdigest()
i = 0
j = 0
k = 0
l = 0
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
found = False
for i in letters:
if(found):
break
else:
for j in letters:
if(found):
break
else:
for k in letters:
if(found):
break
else:
for l in letters:
password = i+j+k+l
print(str(i) + ": "+password)
hashpassword = (md5(password, "constant"))
if(hashpassword == targetpw):
print("Passwort gefunden! Es lautet: "+password)
found = True
break
https://repl.it/@kaibox99/stacklounge-5133
Wahrscheinlich nicht das Eleganteste, aber ein Startpunkt.