Encrypting an Image

MPICT Summer Faculty Development Week

Cryptography Class by Casey W. O'Brien

Getting a Starting Image

I used Google to find a simple logo to work with. For this demo you need a file with regions of identical color, not a blurred or textured image.

I opened the file in Paint (on Windows XP) and converted it to a 24-bit BMP.

In CrypTools, I opened the image, and encrypted it using DES in ECB mode.

The file is encrypted now. The image below shows the original file on the bottom, and the encrypted version in the top.

The original image starts with the letters BM -- that starts the file header for a bitmap.

The upper file is encrypted. Notice that the BMP header is also encrypted, so this file won't open in an image viewer anymore.

I highlight the header, (and the first few bytes of the actual image too because I am sloppy and I don't care), and copy them.

I don't know what CrypTool is asking here, I just used the default selection and clicked OK.

I carefully highlight the same region of the encrypted file and paste the original header there.

Now both files start with BM -- they both have valid bitmap headers.

I save the file with the name DES_ECB.bmp.

Open the encrypted bitmap in Paint.

Here is the result: an encrypted image in ECB mode, which retains a lot of the structure of the original image.

Sources

Wikipedia page: Cipher-Block Chaining (CBC) and Electronic Codebook (ECB) modes of DES encryption.


Sam Bowne
Last modified 12 pm Wednesday, June 27, 2012