# How do you bruteforce decrypt data if you don't know what you are looking for?

If I wanted to brute-force decrypt data, I would try decrypting it with a key and see if the decryption returned nonsense. If the decryption returned meaningful data (ex. something that a natural language processor deemed English, if I was trying to decrypt an English language email), I would assume I had the key. If it did not return meaningful data, I would try again with the next possible key until I had tried all possible keys. But this method would not work if I did not know if I was trying to decrypt a picture, text in Spanish, text in Chinese, an audio file etc.

How do you brute force decrypt if you don't know what you are trying to find?

• You guess based on what is likely. You test the output to see if it seems to match this guess – atk Aug 19 '13 at 12:10

It is an extremely rare situation for a brute-force attacker to work on data where they have no idea at all what is encrypted. When brute-forcing encrypted files in an unencrypted folder labeled "financial documentation", it's a fairly safe guess that if you get valid document, spreadsheet, or PDF files, you've decrypted something.

Even without information leakage from a badly-managed file system, most common file types contain a great deal of standard metadata. PDF files, .doc files, .JPG files, and others contain fairly standard headers. Text files contain information about their encoding. A brute-force adversary would spend time looking for this metadata. (This is, in fact, a form of Known Plaintext attack.) It doesn't matter whether that Word document is in English, Chinese, Swahili, or Esperanto. It's still a Word document, with all the metadata associated with it.

Though it's not precisely what you're asking about, cryptananalysis of the Enigma during World War II involved a similar form of this attack.

• I've never heard of that 'weather report messages'. If you're referring to the Enigma, the encryption was revealed (apart from Turing's efforts at Bletchley Park) because the same key was used for 2 different messages. – ott-- Aug 19 '13 at 21:06
• @ott--: You're right and wrong, now that I take the time to look it up further. (And assuming that the references at the Wiki page on Enigma cryptanalysis are accurate.) I've updated my answer accordingly. – Jonathan Garber Aug 20 '13 at 13:28
• Tsk. I feel hard done by because I answered this pretty much identically 28 seconds earlier than you and didn't get a single upvote! – deed02392 Aug 28 '13 at 16:48
• despite this being a rather old answer: how would they brute-force double encrypted data? wouldn't it all just look like gibberish for them even if they managed to find the right key? – Andre Baumeier Jan 26 '16 at 9:17

Depending on the implementation, there can be straightforward methods of confirming the key was correct.

For example, TrueCrypt utilises an encrypted hash of the valid master key/header. After trying a user decryption key, the hash of the header is checked. If the hash matches, TrueCrypt proceeds to boot, if not then the user is prompted their password was incorrect.

When considering whether this is foolish or not - since you're essentially giving an attacker a way of easily checking if they guessed the right key, don't forget that if TrueCrypt didn't do this, when users did enter an incorrect password the BIOS would then try to boot from essentially a corrupted partition table (and who knows what might happen then, data integrity wise).

In more generic cases, a good method would be to calculate the entropy of the output data. If you are expecting for example a document, then you could safely assume your correct decryption would have a very low entropy, and characters only in the [a-z0-9,.'] character set for example.

• Regarding the example with TrueCrypt: yes, it's foolish and no, it's needed for usability. "who knows what may happen": the BIOS boot loader would not find a valid file system and refuse to boot or simply crash. It is highly unlikely that any BIOS code modifies data on disks. – St0fF Jan 7 '16 at 12:15