使用MD5进行python hashlib解密

-1 投票
1 回答
6928 浏览
提问于 2025-04-18 09:01

问题很简单。我有:

import hashlib
m = hashlib.md5()
m.update(b"My name is Joe")
x = m.hexdigest()
print(x)

这个输出是:

c923c2de3064b7be0223d42697ad57e2

现在我该怎么解密这个呢?

1 个回答

0

MD5是一种哈希函数。换句话说,它的设计并不是为了让你能把它反向解开。要想反向解开MD5,唯一的方法就是尝试所有可能的组合:

for word in all_the_possible_words():
    if md5(word) == my_hash:
        print("I found the word!", word)
        break

不过,这在合理的时间内是做不到的,除非你对你要找的内容有一些信息(比如字符的数量、使用的字符等等)。

另一种可能性是使用彩虹表

撰写回答