Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

NETW1002: TUTORIAL 2

QUESTION 1
¡ Having a plain text of length n of English language and a phrase of length m,
encryption of the plain text is performed by adding letter i from the plain text to
letter i from the phrase. Addition is done by assigning a number to each letter, where
A = 0, B = 1. . . Z = 25, then adding the numbers modulo-26. In case m < n, the
phrase is repeated until there are n letters to add to the plain text letters.
¡ Required:
(a) Is this a monoalphabetic or polyalphabetic cipher?
(b) How many keys can we have to encrypt a particular message?
QUESTION 1
¡ Example:
¡ Plaintext: C O C A Length = n = 4 C:2 O:14 C:2 A: 0
¡ Phrase (key): D G O C Length = m = 4 D: 3 G: 6 O:14 C:2
¡ Encryption = (Plaintext (i) + Phrase (i) ) mod 26
¡ 1st letter = (2 + 3) mod 26 = 5 à F
¡ 2nd letter = (6 + 14) mod 26 = 20 à U
¡ 3rd letter = (2 + 14) mod 26 = 16 à Q
¡ 4th letter = (0 + 2) mod 26 = 2 à C

¡ Output = F U Q C
>> Polyalphabetic because a letter in the message is replaced differently at each one
of its occurrence.
QUESTION 1
(b) How many keys can we have to encrypt a particular message?
Example:
• Letters Pool: A B C
• Key Length: 2

Encryption Options: (Possible Combinations)


AA AB AC
BA BB BC >> 𝑁𝑜 𝑜𝑓 𝐾𝑒𝑦 𝐿𝑒𝑡𝑡𝑒𝑟𝑠!"#$%& '( )"* = 3+= 9 options
CA CB CC

No. of Keys = 𝑁𝑜 𝑜𝑓 𝐾𝑒𝑦 𝐿𝑒𝑡𝑡𝑒𝑟𝑠!"#$%& '( )"* = 26,


QUESTION 2
¡ Triple DES is done by repeatedly DES-encrypting a message m three times using
three keys, i.e., by computing eK3(eK2(eK1(m))).
(a) Is this more secure than regular DES? Why?
(b) Can we have a situation where eK3(eK2(eK1(m))) = eK1(m)? If so, when?
(a) It is more secure as # of key combinations increases 3 times as well as it will be difficult
for intruder to break this cipher and try all possible combinations of key.
(b) eK3(eK2(eK1(m))) = eK1(m), this could be happen if e-1K2 = eK3 (encryption function 2 is the
reverse of encryption function 3 so they will cancel each others and only encryption of m using only
1 layer of DES takes place)
QUESTION 3
¡ In DES, for two different 56-bit keys 𝑘! and 𝑘" and a 64-bit plain text message m,
can we have 𝑒#!(m) = 𝑒#"(m)? Justify your answer.
As mentioned in the first tutorial, we can not get same cipher text from same encryption
function using 2 DIFFERENT keys as input.

Generation of keys block will generate different round keys and hence input to S-boxes will
not be equal and so on.
QUESTION 4
¡ What is the number of all possible mappings from a set S of 64-bit blocks of data to
itself, i.e., the mappings are from S to S where S is the set of all possible blocks that
are 64 bits in length. Consider the following cases:
¡ A bijective Mapping
¡ An Injective Mapping
¡ A general Mapping
Which of the three previous cases can be considered as defining an encryption
function?
QUESTION 4
¡ What is the number of all possible mappings from a set S of 64-bit blocks of data to
itself, i.e., the mappings are from S to S where S is the set of all possible blocks that
are 64 bits in length. Consider the following cases:
¡ A bijective Mapping s s
|M|=|C|
64-bit 64-bit
block block
All possible combinations (the total number of rows) in set S = 2-.

|0|
# of possible Bijective mappings = 1 = | C | ! = 2!" !
|2|
QUESTION 4
¡ What is the number of all possible mappings from a set S of 64-bit blocks of data to
itself, i.e., the mappings are from S to S where S is the set of all possible blocks that
are 64 bits in length. Consider the following cases:
¡ A injective Mapping
• Each output in Y should correspond to one input in X
s s
• Since that the mapping takes place from set S to set S so # of 64-bit 64-bit
block block
keys @ injective = # of keys @ bijective as domain and range of
mapping have same size.

• # of Possible Injective mappings = 2!" !


QUESTION 4
¡ What is the number of all possible mappings from a set S of 64-bit blocks of data to
itself, i.e., the mappings are from S to S where S is the set of all possible blocks that
are 64 bits in length. Consider the following cases:
¡ A general Mapping
Any input in X can produce any output in Y.
s s
It means that repetition is allowed and no constraints are applied so that:
64-bit 64-bit
- 1st block has 𝟐𝟔𝟒 possibilities block block
- 2nd block has 𝟐𝟔𝟒 possibilities and so on

𝟐𝟔𝟒 * 𝟐𝟔𝟒 * 𝟐𝟔𝟒 * 𝟐𝟔𝟒 * ………………………* 𝟐𝟔𝟒


1st 2nd 3rd 4th block # 𝟐𝟔𝟒

𝟔𝟒
Total General Mappings = (𝟐𝟔𝟒 )𝟐
QUESTION 4
¡ What is the number of all possible mappings from a set S of 64-bit blocks of data to
itself, i.e., the mappings are from S to S where S is the set of all possible blocks that
are 64 bits in length. Consider the following cases:
Which of the three previous cases can be considered as defining an encryption
function?

• The bijective and Injective mappings only


QUESTION 5
Show that DES decryption is the same as
encryption except that the order of the rounds is
reversed, i.e., in decryption, we start by round 16, then
round 15, and so on.
As shown in the figure, these are all blocks and operations done
on 64-bits block
- If we reverse all the operations,
𝐈𝐏 3𝟏 𝐰𝐢𝐥𝐥 𝐜𝐚𝐧𝐜𝐞𝐥 𝐭𝐡𝐞 𝐞𝐟𝐟𝐞𝐜𝐭 𝐨𝐟 𝐈𝐏
- We need to make sure now if we reverse the order of rounds
we will manage to decrypt the message or not
- Now we need to prove that, a round can be used for both
encryption and decryption
QUESTION 5
Show that DES decryption is the same as
encryption except that the order of the rounds is
reversed, i.e., in decryption, we start by round 16, then
round 15, and so on. 𝐿# 𝑅#
Encryption Round:
R′5 = f 6 R 5 , k 5
R 578 = R′5 ⊕ L5
𝑅′&

L578 = R 5

𝐿#78 𝑅&'(
QUESTION 5
Show that DES decryption is the same as
encryption except that the order of the rounds is
reversed, i.e., in decryption, we start by round 16, then
round 15, and so on. 𝑅#78 𝐿#78
Decryption Round:
Before entering last round, there is a swapping block that
reverses the left and right 32-bits.
𝑅′&
Remember from the encryption round:
R 578 = R′5 ⊕ L5 and L578 = R 5
Entering L578 and R 578 as inputs for the DES round:
f 6 L578 , k 5 = R′5 ⊕ R 578 = L5 𝑅# 𝐿&
L578 = R 5 Same output
but swapped
QUESTION 6
¡ Show that in DES the first 24 bits of each sub key come from the same subset of 28
bits of the initial key and that the second 24 bits of each sub key come from a disjoint
subset of 28 bits of the initial key.
By examining the key choice table
1st 24 bits:
They are chosen from the first 28-bits of the initial key as:
- The largest index is 28
- The smallest index is 1

2nd 24 bits:
They are chosen from the second 28-bits of the initial key as:
- The largest index is 56
- The smallest index is 29
QUESTION 7
¡ A linear block cipher is one for which ek(m1 ⊕ m2) = ek(m1) ⊕ ek(m2), where m1
and m2 are any two input messages and ⊕ is the XOR operation. Linear ciphers are
not secure, to see this; consider a linear block cipher that encrypts 128-bit blocks of
plain text into 128-bit blocks of cipher text.
¡ Describe how, with 128 chosen cipher texts, an adversary can decrypt any cipher
text without knowledge of the secret key k. (A “chosen cipher text” means that an
adversary has the ability to choose a cipher text and then obtain its decryption. Here, you
have 128 plain text/cipher text pairs to work with and you have the ability to choose the
value of the cipher texts.)
QUESTION 7
¡ A linear block cipher is one for which ek(m1 ⊕ m2) = ek(m1) ⊕ ek(m2), where m1
and m2 are any two input messages and ⊕ is the XOR operation. Linear ciphers are
not secure, to see this; consider a linear block cipher that encrypts 128-bit blocks of
plain text into 128-bit blocks of cipher text.
As mentioned the chosen cipher text is the text that the intruder manages to get as
well as to decrypt without any key
For simplicity, we will assume that we have a block of 3-bits. The intruder manages to
get cipher texts that has 1 at position (i) such that i = 1,2 and 3 (100, 010 and 001) and
their corresponding plain text
QUESTION 7
¡ A linear block cipher is one for which ek(m1 ⊕ m2) = ek(m1) ⊕ ek(m2), where m1
and m2 are any two input messages and ⊕ is the XOR operation. Linear ciphers are
not secure, to see this; consider a linear block cipher that encrypts 128-bit blocks of
plain text into 128-bit blocks of cipher text.
Assume that this is the table that the intruder managed to get.
Cipher Text Plain Text
Binary Decimal Binary Decimal

C1 001 1 M1 110 6

C2 010 2 M2 101 5

C3 100 4 M3 111 7
QUESTION 7
¡ A linear block cipher is one for which ek(m1 ⊕ m2) = ek(m1) ⊕ ek(m2), where m1
and m2 are any two input messages and ⊕ is the XOR operation. Linear ciphers are
not secure, to see this; consider a linear block cipher that encrypts 128-bit blocks of
plain text into 128-bit blocks of cipher text.
This table is derived from the Cipher Text Plain Text
table in the previous slide as Binary Decimal Binary Decimal
the intruder applies Xoring
process in order to get the C4 C1 ⊕ C2 = 011 3 M4 M1⊕ M2 = 011 3
missing cipher blocks as well
as their corresponding plain C5 C1 ⊕ C3 = 101 5 M5 M1 ⊕ M3 = 001 1
texts
C6 C2 ⊕ C3 = 101 6 M6 M2 ⊕ M3 = 010 2

C7 C3 ⊕ C4 = 111 7 M7 M3 ⊕ M4 =100 4
QUESTION 7
¡ A linear block cipher is one for which ek(m1 ⊕ m2) = ek(m1) ⊕ ek(m2), where m1
and m2 are any two input messages and ⊕ is the XOR operation. Linear ciphers are
not secure, to see this; consider a linear block cipher that encrypts 128-bit blocks of
plain text into 128-bit blocks of cipher text.
Final step is to get the block of all 0’s:
𝑒# 𝑧 = 𝑒# 𝑚!⊕ 𝑚! = 𝑒# 𝑚! ⊕ 𝑒# (𝑚!) = 𝐶!⊕ 𝐶! = 𝑍

𝐶! ⊕ 𝐶! = 001 ⊕ 001 = 000


𝑚!⊕ 𝑚! = 110 ⊕ 110 = 000
Thank you!!

You might also like