【发布时间】:2020-08-05 00:27:55
【问题描述】:
我目前正在尝试一个问题,在给定哈希 e77decd0e7c8a7b4688b010241bece45 和盐“$goodluck$”的情况下,我必须在 python 中破解盐渍哈希。我尝试下载 1000 万个最流行的密码 (https://github.com/danielmiessler/SecLists/blob/master/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt),并将其用作字典。然后我将盐附加到单词上,对其进行加密,然后对其进行哈希处理。然后将其与给定的哈希值进行比较。但是我仍然无法破解它。这是我的代码:
import hashlib
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
from Crypto.Hash import MD5
def dictionary_attack(password_hash):
dic = lines #extracted from file
pass_found = False
for word in dic:
word = word+"$goodluck$"
key = get_random_bytes(16)
cipher = AES.new(key, AES.MODE_EAX)
ciphertext, tag = cipher.encrypt_and_digest(word.encode('utf-8'))
hashed_val = MD5.new()
hashed_val.update(ciphertext)
hashed_val = hashed_val.hexdigest()
if hashed_val == password_hash:
pass_found = True
recovered_password = word
if pass_found:
print("Your password is: {}".format(recovered_password))
else:
print("Password not found")
dictionary_attack("e77decd0e7c8a7b4688b010241bece45")
任何帮助将不胜感激。谢谢
【问题讨论】:
-
可能密码不在1000万榜上。这是一些家庭作业吗?有人告诉你密码在那个列表中吗?
-
您可以将链接添加到列表中吗?
-
这是一道作业题。我没有得到任何字典或单词列表或任何东西,所以密码可能不在列表中,但我怀疑他们会让它变得那么困难。
-
将链接添加到列表是什么意思?
-
对不起,我提了这个问题。
标签: python hash salt password-hash