Reputation: 111
On this code:
##script qui brute force les hashs
import hashlib
while True :
try :
wordlist_user = input("entrez votre wordlist: ")
wordlist = open(wordlist_user, "r", encoding='utf-8')
hash = input('entrez le hash que vous oulez cracker (sha224) : ')
break
except :
print('Error')
for word in wordlist.readlines():
word = word.strip()
wordlist_hash = hashlib.sha224(word).hexdigest()
if (hash == wordlist_hash):
print('password trouve: ' +word)
else :
print('password non trouve')
I have this error
wordlist_hash = hashlib.sha224(word).hexdigest() TypeError: Strings must be encoded before hashing
can someone help me ?
Upvotes: 11
Views: 10611
Reputation: 1156
hashlib.sha224()
takes bytes but word
is a string. You'll want to convert the string to the utf-8 encoded bytes with word.encode(encoding = 'UTF-8', errors = 'strict')
Upvotes: 15