1

I have completed all problems in psets 0, 1, 2 comfortably except for the last problem. Crack.c (more comfortable version). I read the cs50 crack.c page and I also watched the walk through twice but still I am not able to understand a lot of things they are mentioning. What is password hashing in the first place? I only understand that crack.c is a program that should crack DES encrypted passwords and that there is some function called 'crypt()'. I don't know what it does but I could not understand anything else. What exactly is the 'Problem'?

2
  • 1
    As with the other "more comfortable" problems, you are expected to have enough prior experience to solve this using concepts that have not yet been covered in class. If you don't have this prior class experience, you might be better to wait to do this problem after week 4 or 5, and move on for now.
    – curiouskiwi
    Jun 22 '17 at 20:47
  • Thank you so much @curiouskiwi! I ever wandered about the less and more comfortable. I'm a total beginner and will choose less. Only one day of search for crack wasted... Sep 17 '17 at 18:33
14

Just imagine one day you get a "hashed password" that could be used to log into your girlfriend's email, what will you do? Is it possible to log into the email with that "hashed password"? Of course, NO, because the "hashed" (or "encrypted") password contains non-sense characters. Typing that encrypted string into the log-in window will lead to the error message of "wrong username/ password".

Now imagine further what if you know the encryption method (crypt function), and the password is alphabet ONLY, with not more than 4 characters? You might consider to do the "guessing" game, following this way: - try a random password, encrypt it (using crypt function), if the result is the same as the "hashed" one mentioned above, then "eureka", you find it. If not, try another password. - repeat the trying process until you find a matching.

However, we should not rely on "randomization" but a scientific sequence to solve the problem: - we try with all passwords of 1 character first, if the true password is there, it's there. Otherwise, next. - we then try with all password of 2 characters, - then try with 3 characters - finally with 4 characters

You will soon or later find a matched password (through comparing the hashed ones) among those tryings.

The problem is a little more complicated, but in general that's the main idea.

Let me know if you still have any question.

1
  • Thanks, I've been thinking along the lines of decrypting that code all along. Really appreciated. Aug 20 '17 at 12:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .