0

As per my understanding AES introduces diffusion in each block it encrypts even with ECB as mode of operation. If that is the case how the patterns are retained in each block?

In this blog https://words.filippo.io/the-ecb-penguin/ penguin outline, eye, body, legs are retained. I expected distorted parts of penguin.

mee
  • 35
  • 5
  • 2
    "how the patterns are retained in each block" they aren't. Why do you think they are in the ECB penguin? – CodesInChaos Oct 03 '22 at 17:06
  • @CodesInChaos Because I still see the penguin in encrypted image. For discussion sake, let us say the penguin eye is one block. If diffusion is applied the first bit is placed in last position, the middle bit is in first position and so on. When that is done I should see a distorted eye. Am I missing something? – mee Oct 03 '22 at 18:27
  • If it's a 24-bit image (I'd guess that's the case for the original), a block is a horizontal line of 5.33 pixels. In grayscale areas this equals the effective block size, in colored areas the effective block size will be a horizontal line of 16 pixels. – CodesInChaos Oct 03 '22 at 19:28
  • 4
    Since the original image is low resolution, large shapes like the penguin itself are preserved, while fine details like the eyes turn to noise. Fillippo's new images are very high resolution, so the 15 pixel wide randomization only covers a very small area, which enables them to preserve even those fine details. – CodesInChaos Oct 03 '22 at 19:33
  • @CodesInChaos Thanks for the answer. It makes sense now. I created aes-ecb penguins myself I see lot of details like eyes, body are missing but outline is preserved with some noise. – mee Oct 03 '22 at 20:33

2 Answers2

2

Have a close look at the following image:-

tux

The purple bar to the immediate left of Tux's right eye is 6 pixels by 1 pixel. That's equivalent to the 'coverage' of a single AES block when encrypting an RGB image (24 bits/pixel).

Since the AES key is fixed, and there is no relationship between adjacent blocks, the only variable is the so called plain text, e.g. Tux. So the 6 pixel strip is microscopically scrambled (intra-block diffusion), but an impression of Tux persists when viewed macroscopically (no inter-block diffusion). If the background is constant, the encrypted image part is constant.

And the relative distortion will decrease as the test image gets bigger. This is the nub of your question. I suggest the original Tuxes were much much bigger than the image you've linked to. That explains why the plain Tux and cypher Tux are virtually the same outline. As you suggest, you would expect to see a much more jagged edge to cipher Tux as the 6 pixel block shreds his outline. Especially the black parts which are quite a solid colour. This is not really apparent, thus I can only conclude the encryption was performed on a much larger portrait and then shrunk for posting. Internet lore.

This illustrates the need for some 'mode' of operation for a block primitive. That will create a relationship between adjacent blocks scrambling poor Tux into an indistinguishable coloured square, like so:-

no-tux

Paul Uszak
  • 15,390
  • 2
  • 28
  • 77
1

@CodesInChaos answered (see comments). I created aes-ecb penguins myself I see lot of details like eyes, body are missing but outline is preserved with some noise.

https://github.com/arjunballa/ecb-penguin

mee
  • 35
  • 5