I have to write a very simplistic password cracker for a Security Class...Basically, the professor gave us a binary file with five encrypted passwords and a list of 354984 possible words. The first part of the assignment was easy, I can crack the 5 passwords in under a second. But the second part is causing me problems.
For part one the passwords only contained lower case letters, so I only had to check the 354984 words. For part two, for each possible password I have to check every possible combination of upper and lower case letters. So a single 4-letter word becomes 16 possible words, and a 10-letter word becomes 1,024 possible words.
I do this by reading a single word, and then finding it's possible combinations and storing them in a temporary String array. I then take each combination one at a time, encrypt them, and compare them to the encrypted passwords given to me. If no combinations match, I take the next word in the file and find its combinations and overwrite the temporary string array. Rinse. Repeat.
I wrote a small side program that calculated average word length and total possible combinations in the file and came up with an average word length of 9 letters, and a total of 181751808 possible combinations. My program cracks the first 2 passwords, aaRDvARk and ABACUS, and then runs out of memory. The list is alphabetical, so it obviously isn't making it very far. Is there a way to clear the "Java Heap Space" occasionally, or anything like that?
I can give code samples if necessary. Thanks.