# Will the complement of a 64-bit key and message produce the complement ciphertext if ECB is used in DES?

Say I have a 64-bit message/key:

P1: 1011.......
K1: 0101.......


I run this message/key pair through DES in ECB mode and obtain some cipher that looks like the following:

C1: 1001.......


Now I take a new message/key pair that is the bitwise complement of the first and put it through the same algorithm:

P2: 0100..........
K2: 1010..........


Will it produce the complement ciphertext?

C2: 0110..........


I'm assuming it will due to ECB's deterministic property, but can anyone verify?

The complementation property of DES states that if $DES_K(P) = C$, then $DES_{\overline{K}}(\overline{P}) = \overline{C}$, where $\overline{X}$ is the complement of a string $X$.
ECB with DES takes a message $M_1M_2\cdots M_\ell$ and computes $C_1C_2\cdots C_\ell$, where $C_i = DES_K(M_i)$, for $1\le i\le\ell$. Therefore, if you encrypt $\overline{M_1M_2\cdots M_\ell}$ with ECB and DES under $\overline{K}$, then you get $C_1'C_2'\cdots C_\ell'$, where $C_i' = DES_{\overline{K}}(\overline{M_i})$. By the complementation property we know that $C_i' = \overline{C_i}$, so the result is the complement of the ciphertext.
• If $\overline{C}$ denotes the complement of $C$, then what is $C'$? Aug 20, 2019 at 23:07