Usually to check password validity we used to create over given password it hash value and compare it with stored one. So password protection relies on strength of hashing function.

Could it be used another approach?

  1. Let's say we have encryption algorithm (doesn't matter which one).
  2. Let assume we have some array of predefined chars (for instance just digits)
  3. Then generate random sequence of chars consisting predefined array (for instance just random sequence of digits)
  4. Encrypt sequence with our algorithm with given password and store it somewhere in safe place (let's call it as saved value)
  5. EDIT Also presumed that channel between client and server provides confidentiality and integrity

Now time to check password validity

  1. Trying to decrypt saved value with probe password
  2. If decryption successfull (meaning mathematically correct) check decrypted value to presence of predefined chars array. For instance if value consists only digits - we assume that password is correct. If decrypted value contains extra chars (except digits) - we would assume that password is incorrect.

Now question: what do you think about crypto-strength of this method?

  • $\begingroup$ I am no expert in cryptography, but I guess all passwords are essentially known if your predefined array is leaked (and the encryption method is known). Hashing does not have that problem. Even if the hashed values are leaked (and the hashing alg is known), there is little but brute-force you can do to figure out the original password (afaik). $\endgroup$ – Raphael Feb 17 '11 at 9:58
  • $\begingroup$ And in my case the same is right. Say if stored value leaked, attacker even knowing encryption algorithm should somehow restore unknown array (which he knows only consist some digits). So the only option again is brute-force - or I'm not right? $\endgroup$ – Barmaley supports Monica Feb 17 '11 at 13:07
  • 4
    $\begingroup$ @barmaley: Some people think you don't need to be a cryptographer to do cryptography. They are very, very wrong. If you don't know what you're doing, you'll make mistakes. Unfortunately, some engineers are not aware of that, and as a result some funny things happen, for example WEP uses a stream cipher together with CRC. $\endgroup$ – Yuval Filmus Feb 17 '11 at 16:12
  • 2
    $\begingroup$ ps: I am not sure if we want to allow discussions on crypto protocols proposed by non-experts on the site. IMHO, if this is a research-level question in theoretical computer science, then it falls in the domain of unpublished work which is not peer-reviewed policy, so I am voting to close the question as "not a real question". $\endgroup$ – Kaveh Feb 17 '11 at 19:23
  • 1
    $\begingroup$ barmaley, I think crypto protocols are complicated constructions and people who lack the basic knowledge on the topic should not design them. If you seriously want to design crypto protocols you should at least have the basic knowledge in crypto, in which case you should start by reading the crypto textbooks. IMHO, trying to reinvent the wheel and asking researchers to verify it is a bad idea. I don't like the idea of non-experts lacking basic knowledge submitting the ideas they come up with here and ask experts check their correctness. The previous and this comment are personal opinions. $\endgroup$ – Kaveh Feb 18 '11 at 22:42

The first problem you face is that a password cannot be used as an encryption key. For instance, let the password be $%^gHk23. How do you interpret this as an AES-256 key?

The second problem is that the client has to send the password in clear, and then the server tries to make a key from it, and decrypt saved values.

Thirdly, the scheme is fixed. No salting whatsoever is incorporated in it, and thus it is vulnerable to a variety of attack, most notably the dictionary attack.

The hashing scheme you described at the beginning of your post is very old. Today, an extremely secure password-based identification scheme, named SRP, is gaining momentum. (See also the demo.)

  • $\begingroup$ 1) I meant based on password calculate hash value which use as say AES key... Or I'm not right? $\endgroup$ – Barmaley supports Monica Feb 17 '11 at 12:43
  • $\begingroup$ About salting and SRP - let me review those methods. I'm sorry - I'm not professional cryptographer... $\endgroup$ – Barmaley supports Monica Feb 17 '11 at 12:43
  • 1
    $\begingroup$ @barmaley: Please review this part of your question: "So password protection relies on strength of hashing function." To me, this says that you are going to use a method which is not based on hashing. Then in a comment above, you said: "I meant based on password calculate hash value which use as say AES key." This seems contradictory, right? $\endgroup$ – M.S. Dousti Feb 17 '11 at 13:24
  • 1
    $\begingroup$ @barmaley: If the channel is secure, you must mention this as part of your model, since this is very important. Please clarify what you mean by "secure": Is is just confidential, or provides both confidentiality and integrity? Moreover, please decide if you want to use hash functions or not. (If I were you, I'd allow the use of salted hash mechanisms.) $\endgroup$ – M.S. Dousti Feb 17 '11 at 13:27
  • 5
    $\begingroup$ The mention of salting and dictionary attack is timely, because Anonymous just used rainbow tables to hack HBGary. HBGary could have defended against that by salting their passwords, which they did not do, despite being a professional security company. Ars Technica has produced some fascinating articles about this. The one that discusses salting and rainbow tables is here. $\endgroup$ – Aaron Sterling Feb 17 '11 at 14:29

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.