Python hashlib模块出现错误
我在谷歌上搜索,发现它是预安装的,不需要使用pip安装 但当我运行一个通过观看youtube编写的程序时,但当我运行它时,我发现了错误Python hashlib模块出现错误,python,error-handling,hashlib,Python,Error Handling,Hashlib,我在谷歌上搜索,发现它是预安装的,不需要使用pip安装 但当我运行一个通过观看youtube编写的程序时,但当我运行它时,我发现了错误 > Enter md5 hash: b73bf7d3ba1a517644661bc4bcd85f9a > File name: passlist.txt > Traceback (most recent call last): File "hack.py", line 20, in <module> >
> Enter md5 hash: b73bf7d3ba1a517644661bc4bcd85f9a
> File name: passlist.txt
> Traceback (most recent call last): File "hack.py", line 20, in <module>
> digest = hashlib.md5(enc_wrd()).hexdigest() TypeError: 'bytes' object is not callable
将
digest=hashlib.md5(enc_wrd()).hexdigest()替换为digest=hashlib.md5(enc_wrd).hexdigest()
,因为enc_wrd
是字节,不能调用它
import hashlib
flag = 0
counter = 0
pass_hash = input("Enter md5 hash: ")
wordlist = input("File name: ")
try:
pass_file = open(wordlist, "r")
except:
print("No file found")
quit()
for word in pass_file:
enc_wrd = word.encode('utf-8')
digest = hashlib.md5(enc_wrd()).hexdigest()
if digest == pass_hash:
print("Password found")
print("Password:" + word)
flag = 1
break
if flag == 0:
print("Password is not in list")