Can anyone explain why formula 1 is safer than formula 2?I don't get it even I get the answer.

According to 2, it says as s is in plaintext form, the attacker can decrypt the password by (y.s).

Isn't it is the same for formula 1? That is, attacker can also decrypt the password by (y.s)

What is the difference between these 2 formulas which makes formula 1 to be safer than formula 2?

  • 1
    In [2] isn't s stored in the password file, therefore it can be decrypted, whereas in [1] s is also stored in the password file but because password is the key it cannot be decrypted without knowing password? – SilverlightFox May 28 '16 at 18:27
  • @SilverlightFox: you are exactly correct. I expanded greatly on this concept in my answer and also tried to explain why part of security is understanding how a system can potentially be attacked/broken, and not just relying on memorizing the "correct" way to secure a system. – Mark Ripley May 29 '16 at 7:22

The process of judging the security of information stored in a password database is done with the assumption that an adversary (hacker) not only knows which cipher/encryption method you are using, but also that he has stolen a copy of your password database. Knowing those things, the hacker wishes to discover password so he can pretend to be a valid user.

In the problem described, the we assume the hacker has stolen the database and can see the values of both S and Y for every user contained in the database. The difference between the two methods is in what the value of Y consists of.

In method 1, [password] is combined with [salt] and then that value is block-cypher encrypted with key [password].

In method 2, [salt] is combined with [password] and then that value is block-cypher encrypted with key [salt].

The fact that the password and salt are mixed in different ways in the two examples is irrelevant; the critical fact you should notice is what key was used to create Y.

In method 1 the key used for encryption is password. The hacker doesn't know what the password is, since it has been encrypted before storing it inside Y in the database. In method 2 the key used for encryption is S. The hacker knows what S is, since it's right there in the database.

If method 2 is used, the hacker can decrypt Y immediately to discover password using the keyword S. If method 1 is used, he will have to break the encryption of Y without knowing the encryption key [password]. So method 1 is a more secure way of building a password database.

  • 2
    Although both are less than optimal - a salted hash would be better precisely because you couldn't recover the password from it. Fine as an exam question, but terrible for real world applications! – Matthew Jun 2 '16 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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