You are on page 1of 7

UNIVERSITI TEKNOLOGI MALAYSIA

Faculty of Computer Science and Information Systems

Cryptography MCS 1413

LAB 2 Understanding Symmetric Cipher


Objectives: (a) To explore the various block cipher modes of use. (b) To demonstrate the effect of using weak key in DES. (c) To explore the Brute Force analysis. (d) To explore the operation of the AES encryption algorithm by tracing its execution. (e) To demonstrate Avalanche Effect in AES.

Important Instructions:
(a) Write down your answer on the space provided.

Name Matric Number Section

ORYZA SAFUTRA BIN UMAR MC111042 MCS1413-01

Lab Task A: Block Cipher Modes of Use


For this part of this lab, you will be encrypting using CrypTool, the same message using the same key, twice, once in ECB mode, then in CBC mode.
1. Open CrypTool > File> New>. Enter your own plaintext in the working area window. Plaintext (8 bytes length in hexadecimal): 123ABCDE 2. Copy and repeat your text at least twice. 3. Select Encrypt/Decrypt > Symmetric (Modern) > DES (ECB) Enter your key (in hexadecimal): 11 AA 00 BB 11 CC 00 DD 4. Click View, then click Show as HexDump so that the ciphertext is displayed in hexadecimal. Copy the encrypted text in hexadecimal.: C1 43 78 D5 DD 28 04 A4 5. Select Encrypt/Decrypt > Symmetric (Modern) > DES (CBC). Enter the same key that you used in Step 3. 6. Copy the encrypted text: C1 43 78 D5 DD 28 04 A4 46 F2 A5 A6 4C 28 66 73 7. Compare the encrypted text in step 4 (using ECB Mode) and step 6 (using CBC Mode). What can you say about the block cipher in each mode? ECB mode encrypted the plaintext individually and independently. In mathematically, encrypted mode ECB expressed as Ci = EK (Pi) and decryption as Pi = DK (Ci) CBC mode establishes a mechanism feedback on a block, which in this case the results of previous encryption is use in current encryption block. In mathematics, the formula is Ci = EK (Pi Ci-1) and decryption as Pi = DK (Ci) Ci-1

(5 points)

Lab Task B: Weak Key (DES) and Brute Force Analysis


1. By using plaintext and key given below, encrypt the plaintext using CrypTool in DES (ECB) mode.

Plaintext: Key:
2.

She sells sea shells at the sea shore 0101 0101 0101 0101

By using the same plaintext and key, do the encryption process again with the same mode. What can you conclude from the plaintext, ciphertext and key used in this encryption? If the same block of plaintext and key is encrypted twice with ECB, the two resulting blocks of ciphertext will be the same (1 point) Encrypt the plaintext and key given in the Question 1 by using another mode which is DES (CBC) mode. Encrypt the plaintext twice. What can you conclude from the plaintext, ciphertext and key used in this encryption? This mode establishes a mechanism feedback on a block, which in this case the results of previous encryption is use in current encryption block. With the CBC mode, each block in ciphertext depends not only on plaintext block but also on the entire block plaintext before (1 point)

3.

4.

What is the difference between the ciphertext in the ECB and CBC mode? What can you conclude about the key and ciphertext in each mode? ECB provides the algorithm more simple with the ability to decrypt and proper encryption and appropriate but has a weakness if the the key messages is known the plaintext can be uncovered. While at the CBC mode process is far more complicated and requires more mathematical treatment than ECB mode, however the security data can be stored more secret because bits of bit encrypted is not from plain text directly but from the bits of bits that have been previously encrypted. (2 point)

5.

Now, try to apply Brute Force analysis to the ciphertext that you get from the first encryption process in the Question 8. Select Analysis > Symmetric (Modern) > DES (ECB). On the pop-up window, replace the asterisk * by inserting part of the key given in Question 8 (e.g. 0101 0101 **** ****). Then, click Start. A pop-up window will appear to indicate that the analysis is in progress. You dont have to wait for the analysis to complete, click Cancel. Did you see the original plaintext on the pop-up window?

6.

By using DES (EBC) mode, encrypt the plaintext given in the Question 1 by using the key given below:

Key:
7. 8.

6C68 C1FF 779E 89BA

Repeat the same step in Question 5 to apply Brute Force analysis to the ciphertext that you get from the previous question. What do you learn from the above experiment? If the key is complicated like the second is hard to decrypt the ciphertext even thought we now the key to decrypt the result is unknown, but if the key is simple like the first is easy to decrypt we just need to now 01 and then we get the plaintext .

(1 point)

Lab Task C: Avalanche Effect in AES


1. Open the following URL: http://www.unsw.adfa.edu.au/~lpb/src/AEScalc/AEScalc.html 2. Using the AES Calculator on the website encrypt the plaintext given below using the key in 128-bit (32 hex digits). i. Copy the value of plaintext and key to your AES Calculator on the website. Click Encrypt. Copy the ciphertext.

Plaintext1: Key: Ciphertext1:

0011 2233 4455 6677 8899 aabb ccdd eeff 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f 69c4e0d86a7b0430d8cdb78070b4c55a (1 point)

ii. Note how the value of the state (result of each round) changes round by round. Copy the ciphertext from AES
Calculator for each round into the table by writing it on row CTxt1.

iii. Compare the values of plaintext1 with plaintext2 below. There is a 1 bit difference between these plaintexts.
Determine which bit number is the different bit (bit number starts with 1 and ends with 128 from left to right)? Answer: ____32_____ bit

Plaintext2: Ciphertext2:

0111 2233 4455 6677 8899 aabb ccdd eeff a556156c72876577f67f95a9d9e640a7


(2 point)

iv. Encrypt plaintext2 as shown in the table below using the same key as in question 2(i). Copy the ciphertext for each
round into the table by writing it on row CTxt2.

v. Calculate the bit difference in the ciphertext for each column. Then, calculate the total number of bit difference for
each round. You may use Table I in the Appendix to find the difference in bit. Note: You may do a minimum of 6 rounds and conclude.

Text
Round

Type
PTxt1 PTxt2 Diff. CTxt1

Fill in the ciphertext hex values in the following columns (1 hex value for each column) 0 0 0 0 0 8 b 2 4 5 1 f 7 1 2 9 3 c 8 1 c f 2 d 0 3 f c 2 0 1 1 0 1 1 9 7 3 9 5 2 a 0 2 4 e 2 8 8 0 6 3 2 1 5 1 d 4 2 1 1 1 1 0 d c 1 1 1 0 6 f 2 7 2 2 1 a 3 2 8 2 8 4 2 e e 0 1 1 0 0 0 8 7 4 5 b 3 3 c 4 2 e 2 6 4 1 f b 1 7 3 1 3 f 2 2 2 2 2 0 1 0 1 5 5 0 6 a 2 4 d 2 7 0 3 e 2 2 6 e 1 b 8 2 2 2 0 0 0 0 f 4 9 7 3 a 7 3 0 1 1 7 b 2 1 c 3 c 8 1 a 9 2 3 3 3 3 0 e c 1 8 9 1 2 9 3 2 4 2 b 5 3 0 9 2 0 b 3 d 0 3 3 3 0 0 0 8 9 1 f d 1 8 5 3 3 1 1 c 5 2 9 a 2 f e 1 2 0 1 4 4 4 4 0 8 8 0 5 1 1 2 8 2 6 6 0 9 b 1 f e 1 7 e 2 0 6 2 4 4 0 0 0 5 5 0 5 3 2 5 1 1 9 c 2 b 4 4 7 e 2 9 6 4 5 3 2 5 5 5 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4 f 3 5 9 2 1 e 4 c b 3 f 4 3 3 5 2 e e 0 0 0 f f 0 3 4 3 d 8 2 b f 1 9 a 2 f a 2 4 1 2 7 0 3 f f f f 0 e e 0 f 5 2 1 0 1 6 7 1 9 b 1 5 9 2 1 1 0 f 3 2 f f 0 0 0 4 4 0 7 0 3 7 1 2 c 7 3 6 c 2 d 9 1 f d 1 1 f 3

Total Bit Difference

CTxt2 Diff. CTxt1

CTxt2 Diff. CTxt1

17

CTxt2 Diff. CTxt1

64

CTxt2 Diff. CTxt1

65

CTxt2 Diff. CTxt1

64

CTxt2 Diff. CTxt1

70

CTxt2 Diff. CTxt1

71

CTxt2 Diff. CTxt1

58

CTxt2 Diff.

66

CTxt1

b 7 2 6 a 2

d 9 1 9 5 2

6 8 3 c 5 2

e 0 3 4 6 1

7 a 3 e 1 4

c 1 3 0 5 2

3 9 2 d 6 3

d 0 3 8 c 1

f a 2 6 7 1

2 c 3 a 2 1

b 1 2 7 8 4

5 6 2 b 7 2

7 d 2 0 6 2

7 0 3 4 5 1

9 9 0 3 7 1

e 4 2 0 7 3

0 3 2 d f 1

b 6 3 8 6 3

6 8 3 c 7 3

1 2 2 d f 1

2 b 2 b 9 1

1 f 3 7 5 1

6 a 2 8 a 1

e b 2 0 9 2

8 e 2 7 d 2

b 7 2 0 9 2

1 c 3 b e 2

0 1 1 4 6 1

b 4 4 c 4 1

6 e 1 5 0 2

8 8 0 5 a 4

9 2 3 a 7 3 62 71

CTxt2 Diff. CTxt1

10

CTxt2 Diff.

(5 points)

vi. What can you conclude about Avalanche Effect in AES? Is it strong or not? Why?
Avalanche effect is the effect, where if there is a change in the (cipher / plain) text, then the total output should be different! Avalanche effect does not change according to the character, but according to the BIT. Eight bits equal one byte, or one character is a combination of 8 bits of, if one of the bits have been changed, then the avalanche effect would arise. If the cipher changes the transmission, it is certain, It is not going to be able to decrypted again.

(2 points)

Appendix
0 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4

1
1 0 2 1 2 1 3 2 2 1 3 2 3 2 4 3

2
1 2 0 1 2 3 1 2 2 3 1 2 3 4 2 3

3
2 1 1 0 3 2 2 1 3 2 2 1 4 3 3 2

4
1 2 2 3 0 1 1 2 2 3 3 4 1 2 2 3

5
2 1 3 2 1 0 2 1 3 2 4 3 2 1 3 2

6
2 3 1 2 1 2 0 1 3 4 2 3 2 3 1 2

7
3 2 2 1 2 1 1 0 4 3 3 2 3 2 2 1

8
1 2 2 3 2 3 3 4 0 1 1 2 1 2 2 3

9
2 1 3 2 3 2 4 3 1 0 2 1 2 1 3 2

A
2 3 1 2 3 4 2 3 1 2 0 1 2 3 1 2

B
3 2 2 1 4 3 3 2 2 1 1 0 3 2 2 1

C
2 3 3 4 1 2 2 3 1 2 2 3 0 1 1 2

D
3 2 4 3 2 1 3 2 2 1 3 2 1 0 2 1

E
3 4 2 3 2 3 1 2 2 3 1 2 1 2 0 1

F
4 3 3 2 3 2 2 1 3 2 2 1 2 1 1 0

Table I Difference in Bit for Hexadecimal Numbers The row and column specified Hexadecimal Digit. To find the difference, simply match the Hexadecimal Digit, and find intersection cell of row and column. The digit in intersection cell is the difference in bit.