hacktricks/misc/basic-python/bruteforce-hash-few-chars.md

17 lines
367 B
Markdown
Raw Normal View History

# Bruteforce hash \(few chars\)
```python
import hashlib
target = '2f2e2e' #/..
candidate = 0
while True:
plaintext = str(candidate)
hash = hashlib.md5(plaintext.encode('ascii')).hexdigest()
if hash[-1*(len(target)):] == target: #End in target
print('plaintext:"' + plaintext + '", md5:' + hash)
break
candidate = candidate + 1
```