python - MD5 Hash Cracker -- Unicode 对象必须在散列之前进行编码
问题描述
我正在努力让这个脚本工作。我不确定我需要在哪里添加编码。我收到错误“Unicode 对象必须在散列之前进行编码”
import hashlib
import sys
import pybip38 # pip install pybip38
# Note: The pybip38 is limited to Bitcoin (only) BIP38 encoded keys, NOT other alt-coins that use
BIP38. Probably based on validation performed by that library.
# Example BIP38 Key. Password = test
BIP38 = '6PRSDyF92mGmAqG66BpAfo3sPGrHmkqgkriwQevP82satGzVQjWobYCXxc'
for line in open('passwords.txt'):
passwords = []
password = line.strip()
md5 = hashlib.md5(password).hexdigest()
sha512 = hashlib.sha512(password).hexdigest()
sha256 = hashlib.sha256(password).hexdigest()
passwords.append(str(password))
passwords.append(str(password) + str(password))
passwords.append(str(md5))
passwords.append(str(md5) + str(md5))
passwords.append(str(sha512))
passwords.append(str(sha512) + str(sha512))
passwords.append(str(sha256))
passwords.append(str(sha256) + str(sha256))
for item in passwords:
print "# Trying password: %s" % item
if pybip38.bip38decrypt(item, BIP38) != False:
print "\n## KEY FOUND: %s\n" % item
sys.exit(0)
print "\n## Password NOT found :-(\n"
解决方案
推荐阅读
- sql - Oracle - 在 Case when.... then.... 里面 using is not null
- python - 想使用 BeautifulSoup 从 yahoo Finance 中检索股票公司名称
- angular - 如何在基于安全 Angular + Spring Boot 的 Web 应用中实现登录页面
- ios - UserDefaults 中的值仅在重新启动后出现
- javascript - jQuery - 删除值复选框选择
- ios - Swift:将变量从 tableViewCell 发送到父视图
- javascript - 单击div时如何平滑滚动?
- matplotlib - matplotlib 弹出窗口移除
- git - 如何在此标签顶部显示提交
- forms - 如何在 bootstrap4 表单输入组中使用带有按钮的 float 或类似的 css 命令?