Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Currently I am having a doubt, while making a "DES PCBC" encryption on an image I observe a bit of the silhouette of the image (Probably because of the XOR between plaintext blocks and ciphertext ones on the algorithm). That happens if I set IV and Key to 0.

However, if I change just the key (key in HEX values), the silhouette disappears. It doesn't happen when I leave the key at 0 and only change the IV.

Currently, I'm a bit lost. Apparently I'm seeing the ciphertext "prevailing" over the plaintext on key change, but I'm seeing plaintext "prevailing" with ciphertext if I don't change the key.

Can someone explain why that happens?

EDIT

If I leave IV and Key at 0 in PCBC I see a dim image silouette (I am using DES because I'm making a mode analysis). I also see the dim image silhouette if I increase the IV (with the key at 0), but if you increase the key (and keep IV at 0), the silouette is no longer visible.

I want to know if in the XOR and a big key the Ciphertext prevails over plaintext, because in that case I would have solved a problem in my PCBC analysis.

share|improve this question
2  
I'm confused. What exactly are you seeing in the image? –  pg1989 Oct 9 '13 at 23:04
2  
I'm confused. Why are you using DES? –  nightcracker Oct 9 '13 at 23:07
    
If I leave IV and Key in zeros in PCBC I see a dim image silouette (I am using DES because I'm making a mode analysis) that happens also if you increase the IV (key in zeros), but if you increase the key (IV in zeros), the silouette is no longer visible, I want to know if in the XOR and a big key the Ciphertext prevails over plaintext, in that case I would have solved a problem in my PCBC analysis –  user2863147 Oct 10 '13 at 13:49
    
What you describe reminds me of the images at en.wikipedia.org/wiki/Block_cipher_modes_of_operation where they use them to show that ECB sometimes badly fails at hiding data patterns. –  e-sushi Oct 10 '13 at 15:17
    
This may be a problem with the key schedule. I would consider posting a link to examples to compare –  Richie Frame Oct 10 '13 at 18:44
show 1 more comment

1 Answer 1

Here is what I suspect is going on:

The all-zero key in DES is a weak key; it has the property that encrypting a block twice will result in the original block; that is: $E_0(E_0(M)) = M$ for all blocks $M$.

In PCBC, we encrypt a block $P_i$ by taking the previous plaintext blocks $P_{i-1}$ and the previous ciphertext block $C_{i-1}$, and computing the next ciphertext block $C_i = E_k( P_i \oplus P_{i-1} \oplus C_{i-1} )$.

Here is how PCBC may interact badly with weak keys; let us assume that we have a string of repeating patterns; that is, $P_{i-2} = P_{i-1} = P_i$, and we don't care what that pattern is (all 0's and all 1's are likely to be the most common in practice).

Then, we can take the definition of PCBC, and replace $C_{i-1}$ with how that is computed, we get $C_i = E_k( P_i \oplus P_{i-1} \oplus E_k( P_{i-1} \oplus P_{i-2} \oplus C_{i-2} ))$.

Now, if the plaintext blocks are the same, this simplifies to $C_i = E_k( E_k ( C_{i-2} ))$. And, if $k$ is a weak key (such as all zeros), this simplies to $C_i = C_{i-2}$.

That is, any long sequence of white space or black space will encrypt into alternating sequences of blocks; this can be seen, and is likely the cause of the silhouette. If you switch the key to a nonweak key, this simplification doesn't happen, and so the silhouette disappears.

(BTW: a similar thing would happen with the more traditional CBC mode with white space).

share|improve this answer
add comment

Your Answer

 
discard

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.