如何解决我在使用hashlib模块时遇到错误
我在google上搜索时发现它已预先安装,无需使用pip进行安装 但是当我通过观看youtube来运行程序编写时,但是当我运行时却给了我错误
> 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
但它显示此错误字节有时无法冻结
这是我的代码:
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")
解决方法
用digest = hashlib.md5(enc_wrd()).hexdigest()
替换digest = hashlib.md5(enc_wrd).hexdigest()
,因为enc_wrd
是字节,您不能调用它。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。