2

This is the spec:

Specification

Design and implement a program, crack, that cracks passwords.

Implement your program in a file called crack.c in a directory called crack.

Your program should accept a single command-line argument: a hashed password.

If your program is executed without any command-line arguments or with more than one command-line argument, your program should print an error (of your choice) and exit immediately, with main returning 1 (thereby signifying an error).

Otherwise, your program must proceed to crack the given password, ideally as quickly as possible, ultimately printing the password in the clear followed by \n, nothing more, nothing less, with main returning 0.

Assume that each password has been hashed with C’s DES-based (not MD5-based) crypt function.

Assume that each password is no longer than (gasp) four characters

Assume that each password is composed entirely of alphabetical characters (uppercase and/or lowercase).

I read the man page for crypt, and now i'm more confused. I don't want to cross any lines of integrity, so before I give up, I thought I might ask here to see if someone's going to tell me that this looks way harder than it is.

thanks

  • I also have the same question. Even I didn't get the concept of hash function. – Indhlal Amrith Oct 15 '18 at 18:19
2

Crack is a 'more comfortable' problem, so it assumes that you have programming experience and that you have a knowledge of arrays, strings, loops, etc. If you don't consider yourself in the 'more comfortable' group of students, then you will find this to be a challenging problem requiring lots of outside study (you cannot solve this with the materials covered in the class so far).

| improve this answer | |
  • Thanks, I do feel 'more comfortable. I think the specifics of C's crypt function, and words like 'salt' is what is throwing me off. There I have no experience at all. – phindex Oct 23 '17 at 7:03
0

In the man page, crypt has 2 arguments, key and salt. key is the char *(or string) that you want to hash, and salt is the first 2 letters of the hashed thing. For example, in 50cI2vYkF0YU2(LOL), the key is LOL and the salt is 50.

| improve this answer | |

You must log in to answer this question.

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