有人告诉我,他见过这样的软件系统:

从其他系统检索MD5加密密码; 解密加密的密码和 使用系统自己的算法将密码存储在系统的数据库中。

这可能吗?我认为解密MD5哈希是不可能/可行的。

我知道有MD5字典,但是有真正的解密算法吗?


当前回答

理论上,对哈希值进行解密是不可能的,但您可以使用一些肮脏的技术来获取原始的纯文本。

Bruteforcing: All computer security algorithm suffer bruteforcing. Based on this idea today's GPU employ the idea of parallel programming using which it can get back the plain text by massively bruteforcing it using any graphics processor. This tool hashcat does this job. Last time I checked the cuda version of it, I was able to bruteforce a 7 letter long character within six minutes. Internet search: Just copy and paste the hash on Google and see If you can find the corresponding plaintext there. This is not a solution when you are pentesting something but it is definitely worth a try. Some websites maintain the hash for almost all the words in the dictionary.

其他回答

从技术上讲,这是“可能的”,但在非常严格的条件下(彩虹表,基于用户密码在哈希数据库中的可能性非常小的暴力强制)。

但这并不意味着它是

可行的 或 安全

你不想“反转”一个MD5哈希。使用下面列出的方法,您将永远不需要。“逆转”MD5实际上被认为是恶意的——一些网站提供了“破解”和暴力破解MD5哈希的能力——但它们都是包含字典单词、以前提交的密码和其他单词的庞大数据库。有一个非常小的机会,它将有你需要反向的MD5哈希。如果你已经咸MD5哈希-这也不会工作!:)


使用MD5哈希的登录方式应该是: 在注册过程中: 用户创建密码->密码使用数据库存储的MD5 ->哈希值进行哈希

在登录: 用户输入用户名和密码->(用户名选中)密码使用MD5哈希->哈希与数据库中存储的哈希进行比较

当需要“丢失密码”时: 2个选择:

用户发送一个随机密码来登录,然后在第一次登录时修改它。

or

用户会被发送一个链接来更改他们的密码(如果你有安全问题/等等),然后新密码被散列,并用数据库中的旧密码替换

理论上,你不能。哈希的意义在于它是单向的。这意味着如果有人设法获得哈希列表,他们仍然无法获得您的密码。此外,这意味着即使有人在多个网站上使用相同的密码(是的,我们都知道我们不应该这样做,但是……)任何访问站点A的数据库的人都不能在站点B上使用该用户的密码。

The fact that MD5 is a hash also means it loses information. For any given MD5 hash, if you allow passwords of arbitrary length there could be multiple passwords which produce the same hash. For a good hash it would be computationally infeasible to find them beyond a pretty trivial maximum length, but it means there's no guarantee that if you find a password which has the target hash, it's definitely the original password. It's astronomically unlikely that you'd see two ASCII-only, reasonable-length passwords that have the same MD5 hash, but it's not impossible.

MD5是一个不好的哈希密码:

它的速度很快,这意味着如果你有一个“目标”散列,尝试很多密码,看看你是否能找到一个散列到目标的密码是很便宜的。盐析对这种情况没有帮助,但它有助于增加寻找与使用不同盐析的多个哈希中的任何一个匹配的密码的代价。 我相信它有已知的缺陷,这使得它更容易发现冲突,尽管在可打印文本(而不是任意二进制数据)中发现冲突至少会更困难。

我不是安全专家,所以除了“不要使用自己的身份验证系统”之外,我不会给出具体的建议。从信誉良好的供应商那里找一个,然后使用它。安全系统的设计和实现都是一项棘手的工作。

MD5是一个加密(单向)哈希函数,因此没有直接的方法来解码它。加密哈希函数的全部目的就是你不能撤销它。

您可以做的一件事是使用蛮力策略,即猜测哈希了什么,然后使用相同的函数哈希它,看看它是否匹配。除非散列数据非常容易猜测,否则可能需要很长时间。

不。MD5不是加密(尽管它可能被用作一些加密算法的一部分),它是一个单向哈希函数。作为转换的一部分,大部分原始数据实际上“丢失”了。

Think about this: An MD5 is always 128 bits long. That means that there are 2128 possible MD5 hashes. That is a reasonably large number, and yet it is most definitely finite. And yet, there are an infinite number of possible inputs to a given hash function (and most of them contain more than 128 bits, or a measly 16 bytes). So there are actually an infinite number of possibilities for data that would hash to the same value. The thing that makes hashes interesting is that it is incredibly difficult to find two pieces of data that hash to the same value, and the chances of it happening by accident are almost 0.

A simple example for a (very insecure) hash function (and this illustrates the general idea of it being one-way) would be to take all of the bits of a piece of data, and treat it as a large number. Next, perform integer division using some large (probably prime) number n and take the remainder (see: Modulus). You will be left with some number between 0 and n. If you were to perform the same calculation again (any time, on any computer, anywhere), using the exact same string, it will come up with the same value. And yet, there is no way to find out what the original value was, since there are an infinite number of numbers that have that exact remainder, when divided by n.

That said, MD5 has been found to have some weaknesses, such that with some complex mathematics, it may be possible to find a collision without trying out 2128 possible input strings. And the fact that most passwords are short, and people often use common values (like "password" or "secret") means that in some cases, you can make a reasonably good guess at someone's password by Googling for the hash or using a Rainbow table. That is one reason why you should always "salt" hashed passwords, so that two identical values, when hashed, will not hash to the same value.

一旦一段数据通过哈希函数运行,就没有回头路了。

不可能,至少在合理的时间内是不可能的。

通常的处理方式是密码“重置”。也就是说,你给他们一个新的(随机的)密码,并在电子邮件中发送给他们。