# DES Decryption followed by Encryption, will it produce the original text?

This is regarding DES.

My question is, if a plain text is first decrypted (with the decryption algorithm) using Key K1 and then encrypted using same K1, would the result still be the original plain text?

Yes, like all block ciphers, DES is a PRP. That is a Pseudo Random Permutation. A permutation is a reordering of all possible input values.

In the case of DES there are 2^64 possible input values as the block size of DES is 64 bits. If you have a key and DES in encrypt or decrypt modus then the key will indicate a reordering of all 2^64 possible values. In other words, each value will be translated into another value at the same position in the re-ordered array.

Now of course decryption does the reverse translation to encryption. But if decryption is the exact reverse of encryption, then encryption is the reverse of decryption.

Lets take a look at a possible permutation of two bits for a specific, unspecified key (as writing down a 2^64 permutation is impossible):

``````00 ENC 11
01 --> 01
10 DEC 00
11 <-- 10
``````

You can simply rewrite this as

``````00 DEC 10
01 --> 01
10 ENC 11
11 <-- 00
``````

So in the first column there are all possible plaintext and in the last column all the possible ciphertext.

Obviously it doesn't matter if you switch encryption and decryption.

As some ciphers implementations are actually somewhat more efficient in the decryption direction it may make some sense to switch encryption and decryption around. I haven't seen many protocols that do though; the advantages are minimal while the confusion would be high.

In the case of triple-DES this property is actually used. Triple-DES uses an EDE (encrypt, decrypt, encrypt) scheme for encryption and a DED scheme for decryption. As you can see, the middle part of the encryption and decryption is in reverse.

Side note: The actual number of possible permutations - the number of ways you can reorder all possible plaintext blocks - is very high. To be precise, it's 2^N! where N is the block size. So there are 2^64! (that's about 10^(10^88) - a truly scary number) possible permutations for DES; only one of those is selected by the key.

• Thanks for the answer. I hope this holds true for AES and other block ciphers too irrespective of mode of operation (ECB or CBC) ? – undertaker666 May 19 '16 at 6:47