Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been reading about the 3DES algorithm and I cannot understand one part. In 3DES we do following operation: $$C=E[K_3,D[K_2,E[K_1,P]]].$$ Where $C$ is ciphertext, $P$ is plaintext, $E$ is DES encryption and $D$ is DES decryption.

In the second part we have the decryption with $K_2$. How can we decrypt a cipher with one key ($K_2$) which was encrypted with another one ($K_1$)?

share|improve this question

migrated from Jun 5 '12 at 17:44

This question came from our site for information security professionals.

Perhaps this question is better asked at the crypto portion of stackexchange? – Terry Chia Jun 5 '12 at 10:28
Yeah I know, I found the crypto website after IT security but I had already asked in this website. – Erfan Jun 5 '12 at 10:30
Welcome to Cryptography Stack Exchange. Your question was migrated here, since it touches the more theoretical part of crypto, not so much the security implications thereof. I edited your question to be more clear. If you register your account here, too (using the same OpenID as on Security.SE), you'll get ownership of your question again and will be able to edit and comment. – Paŭlo Ebermann Jun 5 '12 at 20:19
up vote 3 down vote accepted

I do not understand how can we decrypt a cypher which was encrypted with $K_1$, with $K_2$.

Triple DES essentially involves three encryptions on the plain text. First is using $K_1$, second using $K_2$, and third using $K_3$. Now one may argue that $K_2$ is not being used for encryption but decryption. Well, technically speaking, encryption and decryption are just the same, and are only the reverse of each other in all ciphers using the feistel cipher structure. So actually decryption with $K_2$ does nothing but jumble-up the message further more. We are not decrypting the cipher in the real sense. We are adding another layer of obscurity with a second key.

share|improve this answer
...and using the same key for the 3 operations allowed a 3DES system to revert to DES for legacy systems (pre-internet, 1970's kind) with the same code. – ixe013 Jun 5 '12 at 13:01
For a full answer of why the middle operation decrypts, see… – poncho Jun 5 '12 at 17:47
Actually, encryption and decryption are not the same, but are (given a fixed key) different bijective operations on the set of all blocks ($\{0,1\}^{64}$ for DES). They should be the inverses of each other to be called "encryption" and "decryption", though. Also, welcome to Cryptography Stack Exchange. If you register your account here (using the same OpenID as on security.SE), you can take ownership of your post again, edit it and comment. – Paŭlo Ebermann Jun 5 '12 at 20:25

Your Answer


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.