3
$\begingroup$

If I have two different MD5 password hashes with two different salts (the salts are known), is there any way to cryptographically deduce if the two passwords match? Other than brute force password cracking, that is.

$\endgroup$
1
  • $\begingroup$ @Azxdreuwa the latter :) $\endgroup$ Commented Jun 27, 2018 at 22:47

3 Answers 3

5
$\begingroup$

No, if it is possible then it defeats the purpose of using salts. For example, one can build one rainbow table, mapping each possible password together with a fixed salt value to a hash value. Then given another salt value and password hash, one can find the password in the table if what you asked is possible.

$\endgroup$
0
$\begingroup$

Cryptographic hash functions have 2 properties (lets use h() to represent one hash function):

  • Strong collision-free: It is (hard) impossible to find in polynomial time x, y such that h(x) = h(y);

  • Weakly collision-free: If you are given x it is impossible to find in polynomial time y such that h(x) = h(y)

This will also happen even if x = (password + salt1) and y = (password + salt2). There is no way to relate h(x) and h(y) because h(x) != h(y) (different). And since computing the inverse is not possible in polynomial time it will be impossible to relate them (unless $\text{P}=\text{NP}$).

Even if you know x, h(x) and h(y) it would be hard to get y and salt2.

However MD5 and SHA-1 are not strongly collision-free. But they are still weakly collsion-free. They should not be used.

$\endgroup$
2
  • $\begingroup$ Although this does answer the question and is theoretically sound you may want to explain in more terms how this relates to the question; there seems to be a gap between the level of the question and the answer... $\endgroup$
    – Maarten Bodewes
    Commented Jun 26, 2018 at 16:16
  • 1
    $\begingroup$ The non-invertability of commonly used hash functions has nothing to do with P=NP. We have no idea what the optimal complexity of that problem is, we just don't know how to do it. P=NP is a red herring pretty much everywhere in cryptography. $\endgroup$ Commented Jun 26, 2018 at 20:05
0
$\begingroup$

No, this practice would not reduce the safety of your two identical passwords.

The reason is because a secure hash should has an important property call avalanche effect which means if an input is changed slightly, the output changes significantly. Thus, the result of hash(salt1 + password) is dramatically different with the the result of hash(salt2 + password).

$\endgroup$
2
  • 1
    $\begingroup$ deduce -> reduce? $\endgroup$
    – Maarten Bodewes
    Commented Jun 26, 2018 at 16:17
  • 1
    $\begingroup$ Yes, you are right. I mean reduce, not deduce. Just corrected that. Thank you :) $\endgroup$
    – Walt Lin
    Commented Jun 26, 2018 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.