1

I'm part of CS50x and

I've made a code that would check every single possibility for a password of length 8 or less, but the total number of possibilities here is 96^8, so 7,213,895,789,838,336 possibilities in total. In order to process all those possibilities, it would take several thousand years for a long enough password...

It takes around 4 seconds (actually even a bit more) for the program to compute 1,000,000 passwords. And I don't even know if it increases with the length of the passwords it tries... 4 seconds for 1,000,000 passwords makes around 915 years for 96^8 passwords, so this program would need more than a thousand years (assuming there is a big margin of error) to find the "~~~~~~~~" password. (The tilda '~' is the last character the program looks for). (there actually is a big margin of error... At the 200,000,000-th tried password, the program has run for 870 seconds and not 800...)

So I'm wondering if submitting a program that would work but can't be actually tested is okay and is what is expected from us...

(I'm also trying to use the 'words' file before going into that long process, in order to find "weak" passwords quickly, even if the long process would anyway find them.)

By the way, I'm wondering... Is there any way for submitting hacker edition pset "answers" when part of CS50x and not CS50? Because I'd really like to have some feedback on what I've done... I know it's free and all, but I'm just wondering...

(This is actually a duplicate of what's on /r/cs50.)

1 Answer 1

2

So I'm wondering if submitting a program that would work but can't be actually tested is okay and is what is expected from us

It is expected of you to find all the plaintext passwords of the hashed passwords. Your program should terminate in a reasonable amount of time. You can try to crack as many passwords as you want.

By the way, I'm wondering... Is there any way for submitting hacker edition pset "answers" when part of CS50x and not CS50? Because I'd really like to have some feedback on what I've done

No you can't. Hacker editions are for your entertainment and further reading only. As stated at the top of the page in bold:

This is the Hacker Edition of Problem Set 2. It cannot be submitted for credit.

The feedback you want, is the plaintext of the password I guess, which you can print in case you have found the correct plaintext.

Now for the interesting part. It's quite common and well known that a brute force approach for passwords greater than 8 characters is "impossible" in human lifetime (especially with non-optimal hardware), so maybe you should try a dictionary attack instead?

4
  • First of all, the feedback I want is actually about the quality of my code... Anyway thank you for the answer, I thought I'd never get one. And I'm wondering then, why is written things like "What we demand of you is correctness, not necessarily optimal performance." and "you must explain each and every one of your design decisions, including any implications for performance and accuracy, with profuse comments" If nobody is supposed to see the code? Is that only an advice? Cause it doesn't look like one to me...
    – Aizen
    Aug 16, 2016 at 13:07
  • (And I am, actually, using the dictionnary, as I say in the post.)
    – Aizen
    Aug 16, 2016 at 13:12
  • 1
    I think that the above statements are there to urge you to write better code, by documenting everything you write through comments, so that it's easier for you to read your code even after years, and especially easier for others. If you want feedback about the quality of your code feel free to post in here and we will give some suggestions. Also you can google for a better, more extensive dictionary to attack those passwords.
    – ChrisG
    Aug 17, 2016 at 18:04
  • Okay, I get it now. Thank you :)
    – Aizen
    Aug 19, 2016 at 11:00

You must log in to answer this question.

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