Cryptography Homework #3 Solution

$30.00

Description

1. (10 pts) Consider an LFSR with connection polynomial p(x) = 1+x2+x3+x5+x6. Show that p(x) is a primitive polynomial by demonstrating that the LFSR, whose connection polynomial is p(x), generates maximum length sequences (i.e., sequences with the maximum period 26-1).

2. (20 pts) Consider the following binary sequence:

[1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0] Find the shortest LFSR that generates it using the Berlekamp-Massey algorithm.

3. (30 pts) Consider the following ciphertext bit stream encrypted using a stream cipher.

And you strongly suspect that an LFRS is used to generate the key stream:

[0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0,

0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0,

0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0,

0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1,

0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1,

1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0,

0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1,

0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,

0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0,

1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1,

0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0,

1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1,

1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0,

1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0,

1, 0, 0, 0, 1, 1, 0, 0]

Also, encrypted in the ciphertext you also know that there is a message to you from the instructor; and therefore the message ends with Your Instructor”. Find the plaintext and the connection polynomial of the LFSR. Note that the ASCII encoding (seven bits for each ASCII character) is used.

Hint: You can use the following Python function to convert a message in ASCII to binary:

def ASCII2bin(message):

m_i = []

mlen = len(msg)

for i in range(0,mlen): ascii_no = ord(msg[i]) print ascii_no

ascii_bin = bin(ascii_no)

print ascii_bin

char_len = len(ascii_bin)

if(char_len<9):

for j in range(0,9char_len):

m_i.append(0)

for j in range(2,char_len):

m_i.append(int(ascii_bin[j]))

return m_i

4. (20 pts) Consider the combining function given in the following table, that is used to combine the outputs of four maximum-length LFSR sequences:

F(x1, x2, x3, x4) = x1 x2 x1x3 x1x2x4.

a. The lengths of LFSRs are 89, 97, 101, and 103, respectively. Compute the linear complexity and the period of the output sequence. (10 pts)

b. Is the function F nonlinear, balanced and correlation-free? Is this a good combining function? Explain your answer. (10 pts)

5. (10 pts) Consider GF(28) used in AES with the irreducible polynomial p(x) = x8+x4+x3+x+1. a. Perform the following multiplication in GF(28):

(x7+ x4+x3+x2+1) (x7+x5+ x2+x) = ?

b. Show that the inverse of (x7+ x4+x3+x2+1) in GF(28) is (x7+ x6+x4+x3+x2).

6. (10 pts) Consider a modified AES without ShiftRow and Mixcolumn layers. How hard is it to attack it? If you use chosen plaintext attack which plaintexts would you choose?