Hi y 'all. So I am currently trying to do a project in python2 and python3. Basically I’m trying to study how to bruteforce a encrypted ‘password’ in lets say SHA-1 and MD5. I’m not asking for the answer, but I’m trying to understand why it’s important to use hashes and salts along with the hashes.
Well, you are not really using SHA1MD5 with and without salt but plain SHA1/MD5 and bcrypt (which is completely different hashing method).
If you want to implement a simple bruteforce, you can use python’s itertools:
from itertools import product
from hashlib import md5
test_hash = '098f6bcd4621d373cade4e832627b4f6' # md5(test)
n = 4
chars = 'abcdefghijklmnoprstuvxyz'
for i in range(1,n+1):
for j in product(list(chars), repeat=i):
s = ''.join(j)
m = md5()
if m.hexdigest() == test_hash:
print "Found: %s" % s