Question & Answer
Question & Answer
Question & Answer
1. Lecture 1: Introduction
(a) Alice and Bob wish to resolve a dispute over telephone. We can encode the possibilities
of the dispute by a binary value. For this they engage a protocol:
i. Alice Bob: Alice picks up randomly an x, which is a 200 bit number and computes
the function f (x). Alice sends f (x) to Bob.
ii. Bob Alice: Bob tells Alice whether x was even or odd.
iii. Alice Bob: Alice then sends x to Bob, so that Bob can verify whether his guess
was correct.
If Bobs guess was right, Bob wins. Otherwise Alice has the dispute solved in her own
way. They decide upon the following function, f : X Y , where X is a random variable
denoting a 200 bit sequence and Y is a random variable denoting a 100 bit sequence.
The function f is defined as follows:
f (x)
( the most significant 100 bits of x) (the least significant 100 bits of x),
x X
(a) A student has been asked to solve the following problem: Compute the seventh root
of 23 in Z77
by using the Extended Euclidean Algorithm and the Square and multiply
algorithm. Help him to get the solution by approaching the problem as follows:
i. Compute d, the inverse of 7 modulus (77), where (.) indicates the Eulers Totient
function. Use the extended Euclidean algorithm for this.
ii. Compute 23d modulus 77 using the square and multiply algorithm.
(b) A student has been asked to solve the following seemingly simple problem: x 21990 mod 1990.
Help her to get the solution by approaching the problem as follows:
i. Factorize 1990 into prime factors.
ii. For all the prime factors, pi (or its power as may be the case), express the given
congruence as x ai mod pi .
(Hint: Apply Fermats little Theorem, if p is prime, for any positive integer a,
ap1 1mod p.)
iii. Apply Chinese Remainder Theorem (CRT) to get the solution of the original congruence.
4. Lecture 4: Probability and Information Theory
(a) Suppose that four digit Personal Index Numbers (PINs) are randomly distributed. How
many people must be in a room such that the probability that two of them have the same
PIN is at least 12 ?
(b) A very important cryptographic question is to check whether a list contains a collision or
not. The trivial idea is to consider all pairs of the elements of the list with n elements.
Thus this search requires n(n 1)/2 tests. However the search for collisions can be
performed more efficiently in O(nlogn) operations using the following techniques:
i. Sort the list by an efficient sorting algorithm and comparing each element with its
immediate successor. Examine if any collision can be missed in such a method and
modify the algorithm accordingly.
ii. Apply the following hash function, h(x) = last b bits of x. For any new element
x, look into the hash table, T at the address h(x). If the location is unoccupied,
indicated by an empty string , then the element is stored. Else it is checked whether
T [h(x)] = x, in which case a collision is reported, else there is no collision. Examine
the above algorithm to see that a collision can be missed if there is a three-way
collision, ie. x, y, z, such that y = z, x 6= y and h(x) = h(y) = h(z). Show
that b 2n/3, ensures that the probability of such a three way collision is reduced
significantly.
(c) From Information Theoretic point of view answer the following questions:
i. How many 0 1 questions are needed to ascertain a number within 0 and 63?
ii. You are given 12 balls, all equal in weight except for one that is either heavier or
lighter. You are also given a two-pan balance to use. In each use of the balance
you may put any number of the 12 balls on the left pan, and the same number on
the right pan, and push a button to initialize the weighing. There are three possible
outcomes, either the weights are equal or the balls on the left are heavier or lighter.
What is the minimum number of weighings needed to determine which is the odd
ball and whether it is heavier or lighter than the others.
5. Lectures 5 and 6: Classical Cryptography and Cryptanalysis
(a) Which of the following digrams (figure 1) represent injective functions?
(b) Consider a sequence a1 , a2 , a3 . . ., such that an is the residue of pn+2 modulo 24. Prove
that for any prime p, this sequence is periodic with period 2.
(a)
(b)
(c)
=
=
pM (m2 )
1
2
1
4
Suppose that the following table describes how the different keys act on the messages to
produce ciphertexts: Assuming that all keys are equally likely compute the key equivo-
k1
k2
m1
c2
c3
m2
c1
c3
m3
c3
c2
k1
k2
k3
m1
c2
c1
c3
m2
c4
c3
c1
m3
c1
c2
c2
iii.
iv.
v.
vi.
1
Prove that for all 1 i l, DESK1 (pi ) = DESK
(ci ) i, where 1 i l.
2
Prove that of all the possible keys (K1 , K2 ), the expected number of keys for which
1
DESK1 (pi ) = DESK
(ci ) i, where 1 i l, is about 22nlm .
2
Suppose l 2n/m, what can you say to the attacker to help him in developing an
attack against the composed cipher DES 0 ?
The attacker starts building up two lists: L1 and L2 . Each entry in the list L1 and
L2 has l tuples of elements of P followed by an element from K. The lists are filled
with all possible keys.
The lists are now sorted in a lexicographic manner on the l tuples. The attacker now
does a linear search to find out the common l tuples in the lists.
Explain how does the attacker maintain the list and how does this approach help
him to find out the correct key? Show that the amount of memory required by
the attacker is 2n+1 (ml + n) bits and number of encryptions and/or decryptions
required to identify the key is l2n+1 . (Hint: Use the distinguisher: for the correct
1
(ci ) i)
key DESK1 (pi ) = DESK
2
Into what class does the above kind of attack fall?
(b) Let DES(x, K) represent the encryption of plaintext x with key K using the DES cryptosystem. Suppose DES(x, K) and y 0 = DES(c(x), c(K)), where c(.) denotes the bitwise
complement of its argument. Prove that y 0 = c(y).
That is if we complement the plaintext and the key in DES, then the ciphertext also gets
complemented.
Note: This can be proved by the high level description of DES, the actual structure of
S-Boxes or other component functions are irrelevant to this result.
(c)
SP N (x, S , P , (K 1 , . . . , K Nr +1 ))
SP N (y, S , P , (K 1 , . . . , K Nr +1 ))
(g) Suppose that S : {0, 1}m {0, 1}n is an S-Box. Let the pair (a, b), where a =
(a1 , . . . , am ), b = (b1 , .L
. . , bn ), ai , bj L
{0, 1} and 1 i m; 1 j n denote the
m
n
linear approximation, ( i=1 ai xi ) ( j=1 bj yj ) = 0
Let NL (a, b) be an entry in the Linear Approximation Table, that is the number of input
and output pairs for the S-Box which satisfy a given approximation (a, b).
Prove the following facts about the function NL (a, b):
i. NL (0, 0) = 2m
ii. NL (a, 0) = 2m 1 for all integers a such that 0 a 2m 1
iii. For all integers a such that 0 a 2m 1, it holds that:
m
2X
1
NL (a, b) =
22m1 2m1
a=0
Using the above values can you figure out if the shift register was initialized with 1011000101,
what would be the register contents after 500 steps? Can you say how many minimum
such input and output pairs are needed to obtain the output for all possible non-zero
inputs (i.e all inputs for which all input bits are not zero).
(b) Reconstruct an LFSR of the shortest length which generates the sequence {1, 0, 0, 0, 1, 1, 1, 1}
by using Berlekamp-Massey Algorithm.
(c) The following is the description of the A5/1 key stream generator (refer Fig 2). It consists
of three LFSRs denoted by R1 , R2 and R3 , with respective lengths of 19, 22, and 23 bits.
The total content of all the three LFSRs is thus 19 + 22 + 23 = 64 bits. We refer the 64
bit initial contents of the three LFSRs as the key of the cipher. Ri [n] is used to refer to
the nth bit of the register Ri , where i = 1, 2, 3, and n starts from 0. Each LFSR has one
clocking tap: R1 [8], R2 [10], R3 [10]. At each clock cycle, one key stream is generated as
follows:
The three LFSRs make a clocking vote according to the majority of the current three
clocking taps.
Each Ri compares the voting result with its own clocking tap. If they are equal, Ri
is shifted:
a feedback bit is computed by XORing the contents of a fixed subset of cells of
Ri , i.e the feedback for R1 , R2 and R3 is: R1 [18] R1 [17] R1 [16] R1 [13],
R2 [21] R2 [20], and R3 [22] R3 [21] R3 [20] R3 [7] respectively.
the content of all cells in Ri (except the leftmost) are shifted to the left by one
position simultaneously
Ri [0] is updated by the precomputed feedback.
Output the bit R1 [18] R2 [21] R3 [22].
Answer the following questions regarding the above key stream generator:
i. Show that when R1 is loaded with a special initial state, then its state remains the
same in the future.
ii. Compute the number of 64 bit keys (number of initial states of the three LFSRs) so
that the stream cipher generates 64 bit all zero key stream.
13
18
0
R1
21
10
Output
R2
10
22
R3
Majority Control
Shift Direction
= st1
st1
st1
(for odd cells)
i
i
i
t1
t1
= si si (for even cells)
The boundary cells are null, ie. s1 = sn = 0. Consider an n-stage machine and the
sequence generated by the zeroth cell, ie. s = st0 , where t denotes the time instance.
Examine the sequence generated and test it for pseudorandomness by performing the 5
basic statistical tests.
Define h :
x0 ||x00
x =
where x0 , x00 {0, 1}2m. Then define
h(x)
f (x0 x00 ).
i. Show that when n is odd, querying the hash output on the input y1 = y2 = . . . =
yn = y reveals the information of eK (y).
ii. Hence reason that when n is odd, there exists a (1, 1) forger for this hash family.
(d) Consider a hash function, h : {0, 1}1024 {0, 1}128 that satisfies the following property:
x1 x2 (mod 232 ) h(x1 ) = h(x2 )
i. Let Y be a uniformly distributed random element of {0, 1, . . . , 2128 1}. Compute
an upper bound on the probability that Y has a preimage.
ii. Given a value y = h(x), show how to take advantage of the above property in order
to find a preimage of y. Compute the worst case complexity of the algorithm.
iii. Can we use the above result for performing a second preimage attack? Explain your
answer.
iv. Is the above result useful for finding a collision? Explain your answer.
12. Lecture 27-33: Public Key Cryptosystems
(a) Assume that p is an odd prime number. Answer the following questions:
i. Prove that there are exactly
(p1)
2
12 , 22 , . . . ,
(p 1) 2
2
ii. Prove that the product of two quadratic non-residues of p is a quadratic residue of p.
iii. Without using the trial division method how will you decide whether a given number
523 is prime or not? What is the error probability of the test?
(b) A hardware engineer designs a RSA-cryptographic chip with a constant modulus n. However the cryptographer of the company states that this can be potentially harmful: He
states that if the message M is communicated to two destinations after encrypting using
public keys, e1 and e2 . Thus, M e1 C1 mod (n) and M e2 C2 mod (n).
However if gcd(e1 , e2 ) = 1, then either the RSA message can be recovered from C1 and
C2 or the modulus can be factored.
i. Justify that either the multiplicative inverses of C1 and C2 exist modulo n, or n can
be factored.
ii. If the multiplicative inverses of C1 and C2 exist, then the message can be recovered
from C1 and C2 . (Hint: Apply Extended Euclidean Algorithm to find integer values,
s and t st. se1 + te2 = 1.)
(c) Let f be a finite function from finite set E to itself and x0 be a given element of E.
The sequence defined by xi = f (xi1 ) for i N has the shape of the Greek letter ,
i.e composed of a first part, x0 , . . . , xq1 (the tail ) and a second part xq , . . . , xq+l1 (the
loop), such that xq+l = xq . You are provided with two instructions, each costing one unit
of time: M em(x, S) which stores x E and S which is any piece of information. The
other instruction is V al(x) which gives back for any x the last S value such that (x, S)
has been stored or the symbol .
i. Propose a simple algorithm which finds for any (f, x0 ) the values q, l, xq1 and xq+l1 .
What is the average number of f evaluations? What is the average memory size?
ii. Propose a modification of the algorithm that requires a constant size memory. What
is the average number of f computations?
(d) Answer the following number theoretic questions:
i. The objective of this question is to find the secret age of a Chinese captain. The only
information we know is that one year ago, his age was a multiple of 3, in 2 years it
will be a multiple of 5, and in 4 years it will be a multiple of 7. Can you find the age
of the captain?
ii. A student has been asked to solve the following problem: Compute the seventh root
of 23 in Z77
by using the Extended Euclidean Algorithm and the Square and multiply
algorithm. Help him to get the solution by approaching the problem as follows:
A. Compute d, the inverse of 7 modulus (77), where (.) indicates the Eulers
Totient function. Use the extended Euclidean algorithm for this.
B. Compute 23d modulus 77 using the square and multiply algorithm.
iii. Let n = p1 p2 . . . pk , where p1 , . . . , pk are distinct odd primes and an integer
k 2. The element a Zn is said to be a quadratic residue (QR) modulo n if there
exists an x Zn , such that x2 a(mod n). If no such x exists, then a is called a
quadratic non-residue (QNR) modulo n.
C. Prove that Eve can decrypt a message sent to Bob and Alice if gcd(e1 , e2 ) = 1.
You may use Extended Euclidean Algorithm.
13. Lecture 34-36: Elliptic Curve Cryptosystems
(a) Let E be the elliptic curve y 2 = x3 + x + 28 defined over Z71 .
i. What is the number of points on the curve?
ii. Is E a cyclic group?
iii. What is the maximum order of an element in E?
(b) Explain the Montgomery Ladder for performing scalar multiplication in Elliptic Curves
and show the number of finite field primitives reduce from a conventional double and add
algorithm.
14. Lecture 37: Secret Sharing
(a) Let n = 4, t = 2, p = 11, s = 3, a1 = 2. Construct a(X) in the Shamirs Secret sharing
scheme and the shares yi , 1 i 4.
15. Lecture 38-40: Network Security
(a) Define system and the components of system. Is the statement, encryption provides
system security correct?
(b) Explain the Kerberos protocol for key distribution? Explain the functionality of each
step.
(c) How does worms and viruses compare? Describe the components of the virus and how
does it protect from anti-virus softwares?
(d) What is the difference of an Intrusion Detection System (IDS) and firewall?
16. Lecture 41: Side Channel Attack
(a) What is a Side Channel Attack?
(b) Explain the working principle of Differential Power Attacks (DPA) and show how can be
used to attack cryptosystems. Explain with the help of an example of a block cipher.