The ECB Penguin

Tux ecb.jpg

This is an image that has become kind of a cultural icon in the cryptography and InfoSec community. I'm speaking about "the penguin", a picture of the Tux Linux mascot encrypted with a block cipher in ECB mode that still shows clearly the outline of the original.

Google suggestions


You have a cipher, that with a key will encrypt 16 bytes of data. And you have some data, that is more than 16 bytes. So you have a problem. Well, ECB is the wrong solution to that problem: you just encrypt each 16-bytes block separately.

Why is it wrong? Because this way blocks that were equal before encryption will remain equal also after! And this will lead to all kinds of unwanted consequences.

One good example is the recent Adobe passwords crossword game but the best visualization of the concept is him, the penguin!

The original

The original image has been created by User:Lunkwill of en.wikipedia in 2004 and added to the page "Block cipher mode of operation" with this edit.

It has even been proposed as a Wikipedia featured picture.

Nothing more is known about the original. I wrote an email to the author, and I will update the blog post if he replies.

My take at it

The picture is amazing, but rather low quality even for screen, let alone for printing. So, I decided to generate my own.

First thing needed was an image format where the pixels were represented sequentially as plain bytes, without any compression, and possibly with a simple header. The perfect candidate turned out to be the PPM binary format, part of the Netpbm spec. (It is just basically a ASCII header and then a sequence of 3-bytes RGB representations of the pixels.)

Here is the process:

# First convert the Tux to PPM with Gimp
# Then take the header apart
head -n 4 Tux.ppm > header.txt
tail -n +5 Tux.ppm > body.bin
# Then encrypt with ECB (experiment with some different keys)
openssl enc -aes-128-ecb -nosalt -pass pass:"ANNA" -in body.bin -out body.ecb.bin
# And finally put the result together and convert to some better format with Gimp
cat header.txt body.ecb.bin > Tux.ecb.ppm

And the result! Click for the original. Prints on sale, it makes for a great nerdy office decoration, much like "Crypto Safety Procedures"!

Tux ecb.jpg

Bonus: pop art

Also, the color combinations spawning from the different keys reminded me of the Marilyn Monroe by Andy Warhol, so... (Poster!)

POP Tuxes

Visit the shop for other ECB Tux gear! And maybe follow me on Twitter.

Creative Commons License The images are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.