Put in simple terms, for most encryption algorithms: can you technically ever be sure you actually decrypted something?

Sure, if you decrypted a word document and MS Word can open it, you've got a pretty good chance you decrypted it right, but maybe it's the 1/90000000000 chance that it just happened to give this kind of message?

  • 2
    it all depends on the "meaningfulness" of the result of decryption - that's a meta layer of intent that's in the mind of the participant, and not a technical application
    – schroeder
    Apr 15, 2016 at 23:18
  • 1
    While the other answers are also correct, I'll take it even further. While it's exceedingly unlikely, it is not impossible that an incorrect key will decrypt say, a TrueCrypt volume into a byte for byte copy of the of the first photograph you've ever taken with your first girlfriend. Or the declaration of independence. Now, don't expect this to happen, of course. And the chances are, no such key exists for any cipher ever created. But it's not mathematically impossible.
    – forest
    Apr 16, 2016 at 9:02

3 Answers 3


For general purposes, you cannot be 100% sure. If you try the wrong key, you will get a bag of random bits. Those random bits may look like something valid, but they are still the wrong key. Monkeys at a typewriter punching out a few lines of Shakespere, and all that.

In theory you could design an encryption algorithm which intentionally lets you know when you get it right. It would involve adding a block of known content to the message, and verifying that that block is correct when decryption it. However, you would need to avoid the monkeys at a typewriter problem of random chance happening to decode that block correctly. You would have to tailor the encryption algorithm and the block of data itself so that you could prove mathematically that no key besides the correct key achieves a match for that block.

Typically this sort of behavior is considered to be a vulnerability in the encryption algorithm, so you don't see it. It's just too risky to try to add that much provable behavior into your algorithm. Consider the example of the Enigma, where they found that some output patterns simply couldn't occur due to the layout of the rotors, which was a major factor in the breaking of Enigma. You would have to intentionally choose an encryption algorithm that has a similar vulnerability.

  • I already heared about an encryption method that uses some kind of "honeypots". I think this has a good chance to be the future of cryptography.
    – licklake
    Jun 10, 2016 at 5:46

No you can never be absolutely certain that you correctly decrypted the cyphertext but almost every system is designed to detect wheter the key used is correct. This is done using checksums of the plaintext or by using the key to decrypt something whose plaintext equivalent is known. These mechanisms are very unlikely to fail (about 1/2^128) but theoretically thats possible as well.

There are in fact systems that use this to make cracking the code more difficult/impossible. One Example for this is the so called One Time Pad. It uses keys that are as long as the plaintext. Therefore you can find a Key that will decrypt a given cyphertext to any plaintext (of equal length) that you choose. Therefore someone trying to crack this code can not know which one of the potential plaintext/key combos is the correct one.


No, you cant.

There are things like signatures, MACs and padding schemes. While imho it is practically impossible to collide the MAC, the DSA Signature (if the scheme includes one) and the Padding Scheme, its possible in theory.

And - as you said - if the decrypting party is aware of supposed structures in the plaintext (e.g. a Word Document, a JPEG picture, ...) there is another instance that needs to be collided.

The other thing is: decryption is done with the correct key 99.99% of the time. Genuine users of decryption dont have to worry about such coincidences due to the avalanche effect. Brute forcers probably have larger issues than ending up with a good looking but incorrect decryption.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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