You are on page 1of 18

Data Security and Cryptography

06-88-566
ASSIGNMENT 3 and 4

By Name: Nishit Garg


Student Id: 104184514

Problem 1
Consider the following hash function that takes an input x of arbitrary
size and produces a 128-bit output h(x): Let x be a binary number. Then
h(x) = 2127+ (x mod 2127). Check whether or not h(x) satisfies the
three properties for a good hash function
Solution:
Easy to compute:
- Given message m, hash function h(m) is easy to compute.
-Hash function h(x) is easy to compute and is done quickly, so the first
property is satisfied
One-way function y=h(x):
- Here if input x would be having less than 128 bits than h(x)=2127 + x or
x=h(x)-2127 so here the input can be easily recovered.
-Therefore one way function is not satisfied
Collision-free:
- Strong version - It is very hard to find messages m1 and m2 with
h(m1)=h(m2).
-Weak version - Given m1 and h(m1), it is very hard find m2 m1 with
h(m2)= h(m1).
-For the collision free property to be satisfied the output should be different
but here x+2127 have the same output, so the last property is also not
satisfied.

Problem2
There are 39 students registered in the class of 0688566: Data Security
and Cryptography, Fall 2014. Suppose Student A is registered in this
class. (i) What is the probability that at least one other student in the
class shares the same birthday with Student A? (ii) What is the
probability that at least two students in the class share the same
birthday? Show the formulae and give the result.
Solution:

Problem3
Bob setup an RSA system by choosing p=31, q=37, and n=1147. Bob
selects the public key as e=7. (i) Solve Bobs private key d (10 marks)
(ii) Bob wants to put digital signature on the document m=1000 with
message digest h(m)=495. Give the steps for signing phase and solve y
Solution:

Problem4
In the Diffie-Hellman key exchange protocol, Alice and Bob choose a
finite field GF(p), where p=1571, and an element that is the smallest
primitive element in the field. (i). Find the smallest primitive element
in GF(1571); (ii). Suppose that Alice selected random number x=17 and
Bob selected y=26. What is their shared key?
Solution:
-With the help of computer program the Primitive element in GF(1571)
is 2.
-Following are few intermediated results, I have not shown all as they
were long enough to show
2 ^ 1 mod 1571 = 2
2 ^ 2 mod 1571 = 4
2 ^ 3 mod 1571 = 8
2 ^ 4 mod 1571 = 16
2 ^ 5 mod 1571 = 32
.
2 ^ 100 mod 1571 = 945
2 ^ 200 mod 1571 = 697
2 ^ 300 mod 1571 = 416
2 ^ 400 mod 1571 = 370
2 ^ 500 mod 1571 = 888
2 ^ 600 mod 1571 = 246
2 ^ 700 mod 1571 = 1533
2 ^ 800 mod 1571 = 223
2 ^ 900 mod 1571 = 221
2 ^ 1000 mod 1571 = 1473
2 ^ 1100 mod 1571 = 79
2 ^ 1200 mod 1571 = 818

2 ^ 1300 mod 1571 = 78


2 ^ 1400 mod 1571 = 1444
2 ^ 1500 mod 1571 = 952
..
2 ^ 1567 mod 1571 = 982
2 ^ 1568 mod 1571 = 393
2 ^ 1569 mod 1571 = 786
2 is primitive
=2
Alice
x=17
x mod p = 217 mod 1571
i)

= 131072 mod 1571


=679
Alice sends this x i.e. 679 to bob.
Upon receiving y i.e. 457 from bob, Alice calculates xy
xy mod p = 45717 mod 1571
= 144
Bob
y=26
y mod p = 226 mod 1571
= 67102264 mod 1571
= 457
Bob sends y i.e. 457 to Alice.
Upon receiving x i.e. 679 from Alice, bob calculates xy
xy mod p = 67926 mod 1571
= 144

Therefore, Alice and Bob have their shared key 144.

Problem5
In the Diffie-Hellman key exchange protocol, Alice and Bob choose a
finite field GF(211), where the irreducible polynomial is f(x) = x11 + x2
+1. Alice and Bob also choose a field element = x. (i). What is the
order of ? (ii). Suppose that Alice selected random number x=15 and
Bob selected y=17. What is their shared key?
Solution
It is observed that there doesnt exist a number i between 1 to
10000 such that xi mod f(x) be 1. This was observed from a
computer program
So has an infinite order.
i)

The values are calculated from computer program in Java


Alice
Random number x=15
x mod p = X15 mod f(x)
= X6 + X4
Alice sends this x i.e. X6 + X4 to bob.
Upon receiving y i.e. X8 + X6 from bob, Alice calculates xy
xy mod p = (X8 + X6 )15mod f(x)
= 3277642 x10 -1537734 x9+ 4459522 x8 + 4459522
x8-1393271 x7 + 5203478 x6-1908379 x5+ 5217873 x43259147 x3+ 4538131 x2-2076625 x1 + 2027036
Bob
Random number y=17
y mod p = X17 mod f(x)
= X8 + X6
Bob sends y i.e. X8 + X6 to Alice.

Upon receiving x i.e. X6 + X4 from Alice, bob


calculates xy
xy mod p = (X6 + X4 )17 mod f(x)
= 3277642 x10 -1537734 x9+ 4459522 x8 + 4459522 x81393271 x7 + 5203478 x6-1908379 x5+ 5217873 x4-3259147
x3+ 4538131 x2-2076625 x1 + 2027036

So, Alice and Bob have their shared key 3277642 x10 -1537734 x9+
4459522 x8 + 4459522 x8-1393271 x7 + 5203478 x6-1908379 x5+
5217873 x4-3259147 x3+ 4538131 x2-2076625 x1 + 2027036

Problem6
As shown in Fig (b), Page 12, Lecture notes on Chapter 9, assume that
User B has an RSA system with (e,n) as public key and (p,q,d) as private
key. Following the style at Page 13, Lecture notes on Chapter 9, list the
computation steps of Fig.(b). for Confidentiality only.
Solution:

Problem7
In ECDH (Elliptic Curve Diffie-Hellman) Key Exchange scheme, an
elliptic curve E over GF(23) is given as follows: 2=3+9x+17
Let P = (1, 2) be a point on E. Suppose that Alice selected random
number a = 3 and Bob selected b = 5. List the computation steps by
Alice and Bob. What is their shared key (another point on the curve)?
Solution:

You might also like