So I have a simple program which hashes all the values in a list of common passwords then compares the hashes to a hash value given. to then crack the password.
However it doesn't seem to work as passwd_found is still false and I believe its the IF statement that's not working. Any help is appreciated.
dic = [] passwd_hash = '4297f44b13955235245b2497399d7a93' passwd_found = False for k in dic: md5hash = hashlib.md5(k.encode('utf-8')) print(md5hash.hexdigest()) if passwd_hash in md5hash: passwd_found = True else: passwd_found = False
md5hashwill equal the hash of the last string indic. Is that what you want?if passwd_hash == md5hash:, since md5 will always produce a hash of the same length (true for pretty much any hash function).