# Retrieving the 3DES decryption key from plaintext and ciphertext?

I have a hex key that I want to decrypt with a 3DES key in mode ECB.

For example:

hex-key : 0123456789abcdef0123456789abcdef

3DES key: fedcba9876543210fedcba9876543210

result  : c89bc7b07189ed94c89bc7b07189ed94


How can I find the 3ES encryption/decryption key from the two entries hex-key and result?

• So you want to find a 3DES key being only given a single valid plaintext-ciphertext pair (ie one $P$ and one $C$ such that $C=E_K(P)$ for some searched-for key $K$)? – SEJPM May 18 '17 at 18:03
• My interpretation of his question: he has a 128 bit 3DES key in hex ("hexkey"), and want to know how to get the 3DES key... – poncho May 18 '17 at 18:22
• thanks poncho to reply but the 3des is known now fedcba9876543210fedcba9876543210 i search how to calculat this value if i have juste the plaintext 0123456789abcdef0123456789abcdef and the result c89bc7b07189ed94c89bc7b07189ed94 thanks to help – rabie May 18 '17 at 19:12
• @rabie, it looks like you might have somehow ended up with multiple accounts. For help on how to have them merged, see here. – mikeazo May 18 '17 at 19:54
• So what you called hex-key is actually the plaintext and result is the ciphertext you get when you encrypt plaintext/hex-key using 3DES with the key 3DES key. Is that correct. And your question is, if it possible to recalculate 3DES key if all you know is plaintext/hex-key and ciphertext/result? – mat May 19 '17 at 6:45

It is not possible to find a 3DES key from a known plaintext / ciphertext pair (it increasingly looks that this is what you're asking). If that was the case then 3DES would either have to be:

1. vulnerable with regard to the key size or;
2. vulnerable against attacks that invalidate the cipher.

Now although two key triple DES shouldn't be used anymore, it still has a minimum security of around 80 bits (for attacks that are not even applicable in your single plaintext / ciphertext situation).

And, as indicated by the text above, it has certainly not been broken in a sense that you can (easily) recalculate the key. Allowing an attacker to find the full key is as broken as a cipher can get; in general it is assumed that an attacker knows parts of the plaintext.

Just do it!

When 3DES keying option 2 with the 16-byte "3DES key" fedcba9876543210fedcba9876543210 is used in ECB mode to decipher the 16-byte "hex-key" 0123456789abcdef0123456789abcdef (2 blocks), the result is the 16-byte "result" c89bc7b07189ed94c89bc7b07189ed94.