1

My solution for Pset2 crack works for every password except for stelios's. I can crack other 5 character passwords (e.g., ABCDE, etc.), but for some reason, my code runs for 60m9.563s when trying to crack stelios and never returns a result. The hash for stelios's password is 51u8F0dkeDSbY. Any help on why my code can't crack stelio's password?

Here are my results for the other passwords:

[removed solution]

2

Did you let it run to completion or did you stop it while it was still running? This pset is notorious for running very long times for 5 letter passwords. Try running it overnight and see if it completes. If not, then post a comment that it failed.

You might also try moving the lines of code that set the last char to \0 outside of the respective loops to eliminate about 380 million extra computations. Should shorten the processing time a little. (Great demo of how overlooking just one simple thing can increase processing time dramatically.)

Also, I note that stelios' password is the only one that starts with a seed of 51 and not 50. Did you hardcode a seed of 50 by chance?

3
  • I let it run until completion and it failed. After reading your comment I added a printf("failed to crack password\n"); at the end of the program and it printed failed to crack password. I think your point about the stelios seed might be correct because I did hardcode the salt like this const string salt = "50";. I'm going to modify my code to get the salt from the first two characters of the hash. – AndrewAffolter Dec 22 '18 at 8:04
  • If it makes you feel better, when I reran my code against stelios', it ran in about 2 seconds.I expect yours to do something similar, no? ;-) – Cliff B Dec 22 '18 at 13:31
  • Yes, when I fixed my code not to hardcode the salt I was able to crack stelios' password in 0m0.006s. Thanks! – AndrewAffolter Dec 29 '18 at 19:07

You must log in to answer this question.

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