XOR Operator and Entropy

In this lab, you will explore XOR operation, an essential component of many cryptosystems, and the one-time pad, which is unbreakable but impractical. You will compare the effectiveness of XOR with AND and OR operators. In that way, you will be able to practice the importance of entropy in Cryptography. You will also explore the effect of key length in encryption operations.

You will use two cloud-based systems in this lab: Cryptii and hexed.it. You will find the details of both within the instructions. You will also use CrypTool to generate a key by using the RNG (random number generator) in this tool.

Don't use plagiarized sources. Get Your Custom Essay on
XOR Operator and Entropy
Just from $13/Page
Order Essay

You will use the cat image below throughout this lab. Please don’t use the image in this file; instead, download the file cat.bmp in Canvas. (Image courtesy: Betul Karabacak)

Bitmap File Details

Learning/refreshing some information about bitmap files in general and cat.bmp specifically will help you gain insights into what you will be doing in this lab.

Let’s examine the file by checking some properties of it.


It is a 100 x 67 pixel, 256-color bitmap image. The size of the file is 7,778 bytes.

256-color bitmap image means that this file can only store at most 256 different colors. Because the color of each pixel of the image is represented by 8 bits. Therefore, a pixel can be assigned to one of the (2^8=256) possible colors. For example, in this image,

Black is coded as 00000000

Red is coded as 11110000

Yellow is coded as 11111100

White is coded as 11111111

These are the facts:

a) 8 bit corresponds to 1 byte in the digital world.

b) A bitmap file with 100 x 67 pixels has 6700 pixels.

c) Each pixel is represented by 1 byte in a 256 Color bitmap.

Therefore, the data portion of the file takes up 6700 bytes. (Data portion means pixels). The total size of the file is 7778 bytes. Therefore, the header of the file takes up 1078 bytes. The header of a file stores critical data called metadata, metadata stores color table, the size information, resolution details, among other things.

In this lab, you will encrypt the data portion and most of the header portion of the file so that you will still be able to open the encrypted bitmap image with an image viewer, and you will be able to analyze the strength of the different encryption operations.

Although the word “encryption” has been used in this lab, the actual operations are nothing more than ANDing, ORing, and XORing an input data with an operand.