Solved Numericals
Solved Numericals
Solved Numericals
r1
26
11
4
3
1
r2
11
4
3
1
0
R
4
3
1
0
t1
0
1
-2
5
-7
t2
1
-2
5
-7
26
t
-2
5
-7
26
r1
100
23
8
7
1
r2
23
8
7
1
0
r
8
7
1
0
t1
0
1
-4
19
-131
t2
1
-4
19
-13
100
T
-4
13
-13
100
x ak mod mk
Q. 1 Use the Chinese remainder theorem to find a solution to each of the following linear systems:
x 2 mod 3
x 3 mod 5
x 2 mod 7
Soln: Find M = m1 x m2 x m3. This is common modulus
M =3 x 5 x 7 = 105
Find M1 = M/m1 = 105/3 = 35
M2 = M/m2 = 105/5 = 21
M3 = M/m3 = 105/7 = 15
Find M1-1
To find this we have to solve gcd(m1,M1). After solving, use the value of t.
So We need to solve gcd(3,35) and after solving we need to use value of t.
Do not use value of gcd
q
0
11
1
r1
3
35
3
r2
35
3
2
r
3
2
1
t1
0
1
0
t2
1
0
1
T
0
1
-1
Value for t is multiplicative inverse. i.e M1-1 = -1. Make it positive by adding corresponding modulus.
i.e. Here we will add m1. So M1-1 = -1 + 3 = 2
M1-1 = 2
Similarly we can find M2-1 & M3-1
So we got M1-1 = 2, M2-1 = 1, M3-1 = 1
Finally to get the value of X, we need to put all the values in formula,
M = 2*3*5*7 = 210
M1 = M/m1 = 210/2 = 105
M2 = M/m2 = 210/3 = 70
M3 = M/m3 = 210/5 = 42
M4 = M/m4 = 210/7 = 30
M1-1 = 1
M2-1 = 1
M3-1 = 3
M4-1 = 4
X= (a1*M1* M1-1 + a2*M2* M2-1 + a3*M3* M3-1 + a4*M4* M4-1) mod M = 53
X=53
Q.5 Determine the value of x using Chinese remainder theorem
X = 1 (mod 2)
X = 2 (mod 3)
X = 3 (mod 5)
X = 4 (mod 11)
Soln:
M = 2*3*5*11 = 330
M1 = M/m1 = 330/2 = 165
M2 = M/m2 = 330/3 = 110
M3 = M/m3 = 330/5 = 66
M4 = M/m4 = 330/11 = 30
M1-1 = 1
M2-1 = 2
M3-1 = 1
M4-1 = 7
X= (a1*M1* M1-1 + a2*M2* M2-1 + a3*M3* M3-1 + a4*M4* M4-1) mod M = 323
X=323
Q.6 Determine the value of x using Chinese remainder theorem
X = 4 (mod 5)
X = 6 (mod 8)
X = 8 (mod 9)
Soln:
M = 5*8*9 = 360
M1 = M/m1 = 360/5 = 72
M2 = M/m2 = 360/8 = 45
M3 = M/m3 = 360/9 = 40
M1-1 = 3
M2-1 = 5
M3-1 = 7
X= (a1*M1* M1-1 + a2*M2* M2-1 + a3*M3* M3-1) mod M = 134
X=134
Q.6 Determine the value of x using Chinese remainder theorem
X = 1 (mod 13)
X = 11 (mod 23)
Soln: X=287
Q.7 In Chinese remainder theorem, Let N= 210 & let n1 = 5, n2 =6, n3 = 7.
Compute f-1(3,5,2).
Soln:
X = 3 (mod 5)
X = 5 (mod 6)
X = 2 (mod 7)
N = 210
N1= 210/5=42
N2= 210/6=35
N3= 210/7=30
N1-1 = 3
N2-1 = 5
N3-1 = 4
X=23
RSA Algorithm:
Q.1 In RSA cryptosystem consider the given data,
P = 3, Q = 11, M = 2. Find out private key & the cipher text values
Soln:
Given p = 3 and q = 11
Compute n = p * q = 3 * 11 = 33
Compute (n) = (p - 1) * (q - 1) = 2 * 10 = 20
Choose e such that 1 < e < (n) and e and n are coprime. Let e = 3
Public key is (e, n) => (7, 33)
Compute a value for d. If we solve gcd((n),e) and take the value of t, then we will get the
value of d. (If the value of t is negative then add (n) to it)
Solving it by Extended Euclidean algorithm
Q
6
1
r1
20
3
r2
3
2
r
2
1
t1
0
1
t2
1
-6
T
-6
7
n = P*Q = 209
(n) = (p-1)(q-1) = 180
We choose e = 23, We know that gcd((n), e)=1
To get the Cipher text,
C=Me mod n
C=4023mod 209
C=13
To get the plaintext we need to find d.
If we solve gcd((n), e) using Extended Euclidian Algorithm, we will get d = 47.
So to get plaintext,
M = Cd mod n
M = 1347 mod 209
M = 40
Q. 4 In a public-key system using RSA, you intercept the ciphertext C =10 sent to a user whose
public key is e=5, n=35. What is the plaintext M?
Soln:
We know that the cipher text C = 10, and the public key PU = {e, n} = {5, 35}.
Based on Eulers Totient function, (n) is defined as the number of positive integers less than n and
relatively prime to n.
We could find that (n) = 24.
Now, we guess two prime numbers p and q. Let p be 5 and q be 7. All the following conditions will
be satisfied based on the guess:
(1) n = p*q = 5*7=35
(2) (n) = (p-1)(q-1)=(5-1)(7-1)=4*6=24
(3) gcd((n), e) = gcd(24, 5) =1, 1< e < (n)
We calculate d in the next step. Based on RSA key generation algorithm,
d e-1 mod (n) which is equivalent to
ed 1 mod (n) or ed mod (n) =1.
We have e = 5, (n) = 24. So, 5d mod 24 =1, and d = 5.
Now, we find the private key PR = {d, n} = {5, 35}.
Based on RSA decryption algorithm,
M = Cd mod n
= 105 mod 35
=5
We also can verify the correctness by the RSA encryption algorithm as the following:
C = Me mod n = 55 mod 35 = 10
Therefore, we conclude that the plaintext M is 5.
r1
161
28
21
7
r2
28
21
7
0
r
21
7
0
s1
1
0
1
-1
s2
0
1
-1
4
x= -1 & y =6
gcd(161,28)=7 & 161(-1) + 28(6) = 7
s
1
-1
4
t1
0
1
-5
6
t2
1
-5
6
-23
t
-5
6
-23
Q. 1 Explain Fermats little theorem & solve the following using the same
i)
1518 mod 17
ii)
527 mod 13
Soln:
i) According to Fermats Theorem,
ap =p mod p
i.e. (15(17)mod 17) (151mod 17) = 15 * 15 (mod 17) = 225 mod 17 = 4
ii) According to Eulers Theorem,
a(n) 1 mod n