Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

I have a file that is encrypted in AES using a 16 char string. The string is (a-zA-Z0-9) and .,?!. Also, it only contains words from a dictionary (but they can be lower/upper case). What would be the most effective way to brute force this?

(No, I'm not trying to brute force passwords. Who would store passwords in AES…)

share|improve this question
    
Putting a password directly into an AES key for encryption is just as stupid as using the same scheme instead of standard password hashing. –  CodesInChaos Jul 28 '12 at 23:13
    
I know. This isn't a password. I explicitly said this wasn't me trying to hack a password. It's for a video game. (They encrypt the filename table so you can't read it properly). –  Alex Reed Jul 29 '12 at 7:17
    
@AlexReed Perhaps no need to brute force, just read the password from the game's executable. With some luck it's just stored there as a constant string in some data section. Did you try that? –  Thomas Jul 29 '12 at 10:44
    
The table is encrypted upon compile, the engine never needs to read it as it's only there for developers. As the engine never needs to read it, they don't put it in the engine. Sadly. –  Alex Reed Jul 29 '12 at 10:52
    
You seem to have a few conflicting things in your question. You say it was (a-zA-Z0-9) and .,?!. yet you also say it only contains words from a dictionary. I don't see many dictionary words with 0-9 or the punctuation marks listed. Are there some substitutions expected? –  mikeazo Jul 29 '12 at 20:13
show 4 more comments

1 Answer

Based on the comments, it sounds like you know all the requirements/restrictions on the key. One thing that is not clear is if you have a good way of determining if a trial decryption resulted in the proper plaintext. This is usually not a difficult requirement as most data has some structure you could look for. Another important piece of information you are missing (at least as the question is posed) is what mode was used for encryption.

Once you have a plan for both of the items listed above, a dictionary attack is the best you can hope to do as brute forcing the entire keyspace is infeasible. The process is going to be long, but is fairly straight forward. Pick a few words that are less than 17 characters long together. Pad with punctuation to make it 16 characters. Decrypt. Test to see if decryption resulted in the correct plaintext. If not, repeat. You'll want a methodical way to pick words so you don't repeat, but that isn't hard.

share|improve this answer
    
I know a few words in the text, so checking if it has worked won't be hard. But the reason I asked is because I have no idea how I can structure this in code. Could you give me a pointer? –  Alex Reed Jul 30 '12 at 14:58
    
@AlexReed, if this is a coding question, Crypto.SE is probably not the best place to ask. StackOverflow might be better. That said, look at almost any other brute force engine (John, thc-hydra, etc). See how they structure it, how they use their dictionary files, etc. –  mikeazo Jul 30 '12 at 16:19
    
I asked there. All they did was ignore the question and send me here. –  Alex Reed Jul 30 '12 at 16:43
    
@AlexReed, hmm, that's too bad. What do you feel is the most natural approach for coding it up? I had to develop a brute-force password cracker (not what you are wanting, but similar) in school. I started by trying every word in the dictionary. Then I tried combinations of words. Then I started doing substitutions and mixed in capitalization. –  mikeazo Jul 30 '12 at 16:48
    
@AlexReed My eyes are bleeding. What I would personally do is code up a function taking as an input two dictionary words, and combines them in all conceivable ways according to your parameters (so randomly change the case, add punctuation, etc...). Then iterate that function through all possible word pairs and hope for the best. I estimate the password's entropy at 41 bits, so it will likely take a few days to crack on a normal PC. –  Thomas Jul 30 '12 at 21:19
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.