# What will I get if I "decrypt" a plaintext?

If an encrypted text is decrypted with its corresponding key, we would get the plaintext. However, what if I were to decrypt plain text? What would result? An error or some nonsensical number?

• Depending on the mode, sometimes the Encryption and Decryption operation are the same. So decrypting the plaintext could be encryption, or just a nonsensical value. Apr 15, 2016 at 17:00
• Try it with double ROT13 ;)
– Sebb
Apr 16, 2016 at 12:18
• @Sebb: decrypt or encrypt with double ROT13? Apr 16, 2016 at 14:38
• @Hyperum Actually, by doubling its power it gets so good you can't even detect the encryption.
– Sebb
Apr 16, 2016 at 19:10
• – ave
Apr 16, 2016 at 22:00

"Encryption" is a large term. In all generality, encryption takes an input message in some space of possible input messages; usually arbitrary "sequences of bits" with various restrictions on length, e.g. "length in bits must be a multiple of 8" (i.e. input must be a sequence of bytes), or "length must not exceed 245 bytes" (typical of asymmetric encryption with RSA in PKCS#1 v1.5 mode, with a 2048-bit RSA key). The output is al part of some space of possible output messages.

Computers being computers, both input and output messages are ultimately encoded in sequences of bits, so it may happen that input and output message spaces overlap, in which case you can conceptually take an input message (a "plaintext"), interpret it as an output message, and try to decrypt it. This is not necessarily possible: for instance, with RSA asymmetric encryption (PKCS#1 v1.5) and a 2048-bit key, input messages (plaintexts) are arbitrary sequences of 0 to 245 bytes (inclusive) while output messages (ciphertexts) are sequences of exactly 256 bytes, so it is not possible, in such a case, to try to "decrypt a plaintext": possible plaintexts are not long enough to feed the decryption engine.

When you can "decrypt a plaintext", what happens depends on the encryption system. Usually, when decryption works at all, what you get is essentially random-looking nonsense. In some cases, encryption is an involution (e.g. stream ciphers such as RC4 that work by XORing the message with a key-dependent stream), meaning that decryption and encryption are actually the same operation, so by "decrypting" the plaintext you are actually encrypting it.

However, it may also happen that not all sequences of bits of the right length are valid ciphertexts. For instance, consider a block cipher in CBC mode. To encrypt a message m, you must:

1. Pad the message to a length multiple of the block size, by appending between 1 and n bytes (n is the block size) with some specific contents.

2. Generate a new random IV of the same size as the block size.

3. Apply CBC encryption on the padded message, using that IV.

4. Output is the concatenation of the IV and the encryption result.

In such a case, when decrypting, not only must the length be a non-zero multiple of the block size, but after decryption, a valid padding must be found. If using the usual "PKCS#7 padding" (when adding k bytes, all added bytes have value exactly k), the probability that a plaintext of a compatible length actually decrypts to something with a valid padding is about 1/255. In that case, "decrypting the plaintext" will produce a decryption error 99.61% of the time, and some random-looking junk the remaining 0.39%.

Good encryption system include a MAC, in which case attempting to decrypt something which was not the result of encryption with the same key should result in a duly reported decryption error with overwhelming probability.

Summary: when you try to do something that does not make sense, you can obtain various results.

• Summary: when you try to do something that does not make sense, you can obtain various results. Good summary, this extends to programming (and life).
– Hey
Apr 15, 2016 at 18:52

It depends on what cipher you use. For example, with the famous and very secure (sarcasm) `ROT13` algorithm, encryption and decryption are the same operation. If you decrypt a plaintext, actually, you just encrypted it.

With a more modern cipher like AES, you will likely get a big nonsensical number. I think it will be the same for most ciphers.

• Yes, with one clarification that it depends on the mode of operation. AES in a block mode (such as CBC) has a function for encryption and an inverse function for decryption, so attempted to decrypt a plaintext will, as you say, result in nonsense. AES in a streaming mode however, (such as CTR) using the same function for both encryption and decryption and so will simply result in a ciphertext. Apr 15, 2016 at 17:42
• Generally speaking, with a stream cipher (or a block cipher in a streaming mode of operation) encryption and decryption are the same function. Apr 15, 2016 at 17:43
• Even worse is ROT26 this message was encrypted with it Apr 16, 2016 at 9:50

Decryption is merely applying an algorithm to a dataset using a key. Broadly speaking, this is the same as encryption, though the algorithms for encrypt and decrypt may differ. In fact, for some encryption algorithms, encryption is the same algorithm as decryption.

So, broadly speaking, if you apply the "decrypt" algorithm to a plaintext, you'll get a ciphertext encrypted with the decrypt algorithm.

This may not always work of course, depending on the encryption scheme. You might get back an error when you try this. I don't believe this would work with the RSA algorithm for instance.

Whether applying "encrypt" to this ciphertext would get you the plaintext back would depend on the encryption scheme.

Please do not decrypt plain text. Very bad things will happen. You could cause a Server Fault, a Stack Overflow, or anger the Super User. It's possible nothing will happen, and it's possible nothing bad will happen. It depends on the text that you're trying to decrypt.

For example, War and Peace might suddenly cause your PC to morph into the reincarnation of a Cyborg zombie Hitler because it's really the 1000 times encrypted Mein Kampf. Meanwhile, decrypting The Bible might bring about an actual Raptor Jesus due to the sheer belief of The Internets in Him.

The more likely scenarios are that you would cause some kind of physics meltdown in your computer, possibly releasing spurious particles or waves, like neutrons, Bogons, or Morons. We don't need waves of spurious Morons!

Absolute worst case scenario: your computer divides by zero and your house ends up looking like this:

If you could not tell, this was a bit of humor to address the question at face value, and the preceding is not to be taken seriously. Like others have said, there are a lot of variables at play, namely the type of encryption/decryption and specific methods and algorithms used. If you put plain text into a decryption function, in all seriousness, you'll likely get some kind of gibberish out.

However, it is possible to make an algorithm or function to obscure a message in plain text that could be decrypted into another plain text message. However, that would just be another form of encryption and would more likely encrypt words instead of characters. In this case words like English words instead of the computer science words.

• if you encrypt plain text, you get gibberish out, too. Apr 16, 2016 at 16:29
• @schroeder Oh dear, I guess we'll need to stop encrypting our messages to be safe! Seriously though, this answer is just silly, and not because of the attempted humor. It's just... wrong. Mar 16, 2018 at 7:10

Interesting question......

But the result would be some funny looking characters because the decryption process will treat your plaintext as encrypted data and try to decrypt it with a provided key.

• "funny looking characters"? You might need to explain that one. I think you are thinking about different character sets. Apr 15, 2016 at 17:49
• @schroeder Well, if I took `poem.txt`, ran it through a decryption routine and then opened the result in notepad, I would expect to see character-set puke. Not that this answer really gives any insight into what's going on behind the scenes though. Apr 15, 2016 at 18:39