You are on page 1of 19

WWW.UPTUNOTES.

COM

Q.1 What is Abelian Group? List the axioms should obey for Abelian Group.

Ans. Let (G, *) be a group. If a, b belongs to G and a * b = b * a, then the group is said to be
Abelian or commutative group. The following axioms are obeyed for Abelian Group.
(A1) Closure
(A2) Associative
(A3) Identity element
(A4) Inverse element and
(A5) Commutative

Q.2 What are Rings?

Ans. A ring R, sometimes denoted by {R,+, },is a set of elements with two binary operations,
called addition and multiplication, such that for all a, b, c in R the following axioms are obeyed.
(A1-A5) R is an Abelian group
(M1) Closure under multiplication
(M2) Associativity of multiplication
(M3) Distributive law
(M4) Commutative of multiplication
(M5) Multiplicative identity
(M6) No zero divisors

Q.3 Define Fields?

Ans. A field F, sometimes denoted by {F,+, }, is a set of elements with two binary operations,
called addition and multiplication, such that for all a, b, c in F the following axioms are obeyed.
(A1-A6) and (M1-M6) F is a Ring for Integral Domain
(M7) Multiplicative inverse

Q.4 List the three classes of Polynomial Arithmetic.

Ans. The three classes of Polynomial Arithmetic are :

1. Ordinary polynomial arithmetic, using the basic rules of algebra


2. Polynomial arithmetic in which the arithmetic on the coefficients is performed modulo p;
that is, the coefficients are in GF(p)
3. Polynomial arithmetic in which the coefficients are in GF(p), and the polynomials are
defined modulo a polynomial m(x) whose highest power is some integer n.

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 1


WWW.UPTUNOTES.COM

Q.5 State Euler's theorem.

Ans.Euler’s theorem states that for every a and n that are relatively prime.
aΦ(n)≡ 1 (mod n)
Where ϕ(n) is a totient function

Q.6 State Fermat's theorem.

Ans.Fermat’s theorem states the following. If p is prime and a is a positive integer not divisible
by p, then ap-1 ≡ 1 (mod p).

Example: a=7, p =19


718 = 1628413597910449 mod 19 =1

Alternative form of the theorem is : If p is prime and a is a positive integer, then


ap ≡ a mod p

Example: a=3, p =5
35 = 243 mod 5=3 mod 5 =3

Q.7 Explain the principal of public key cryptosystem in detail.

Ans.Public key cryptography also called as asymmetric cryptography.

 It was invented by whitfield Diffie and Martin Hellman in 1976. Sometimes this
cryptography also called as Diffie-Helman Encryption.
 Public key algorithms are based on mathematical problems which admit no efficient
solution that are inherent in certain integer factorization, discrete logarithm and
Elliptic curve relations.

Public key Cryptosystem Principles:

The concept of public key cryptography in invented for two most difficult problems of
Symmetric key encryption.
1.The Key Exchange Problem: The key exchange problem arises from the fact that
communicating parties must somehow share a secret key before any secure communication can
be initiated, and both parties must then ensure that the key remains secret. Of course, direct key
exchange is not always feasible due to risk, inconvenience, and cost factors.

2. The Trust Problem: Ensuring the integrity of received data and verifying the identity of the
source of that data can be very important. Means in the symmetric key cryptography system,
receiver doesn’t know whether the message is coming for particular sender.

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 2


WWW.UPTUNOTES.COM
 This public key cryptosystem uses two keys as pair for encryption of plain text and
Decryption of cipher text.
 These two keys are names as “Public key” and “Private key”. The private key is
kept secret where as public key is distributed widely.
 A message or text data which is encrypted with the public key can be decrypted only
with the corresponding private-key
 This two key system very useful in the areas of confidentiality (secure) and
authentication

A public-key encryption scheme has six ingredients


1 Plaintext This is the readable message or data that is fed into the algorithm as input.
Encryption
2 The encryption algorithm performs various transformations on the plaintext.
algorithm
3 Public key This is a pair of keys that have been selected so that if one is used for
encryption, the other is used for decryption. The exact transformations
Private performed by the algorithm depend on the public or private key that is provided
4
key as input
This is the scrambled message produced as output. It depends on the plaintext
Cipher
5 and the key. For a given message, two different keys will produce two different
Text
cipher texts.
Decryption This algorithm accepts the cipher text and the matching key and produces the
6
algorithm original plaintext.

Public key cryptography for providing confidentiality (secrecy)

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 3


WWW.UPTUNOTES.COM
Q8. Discuss Conventional vs public key encryption?

Ans.

Conventional encryption Public key encryption


Same algorithm with the same key is One algorithm is used for encryption
used for encryption and decryption and decryption with a pair of keys, one
for encryption and one for decryption
Sender and receiver must share the Sender and receiver must each have one
algorithm and the key of the matched pair of keys
Key must be kept secret One of the two keys must be kept secret
Knowledge of algorithm + sample of Knowledge of algorithm + one of the
ciphertext must be insufficient to key + samples of ciphertext must be
determine the key insufficient to determine the other key
It must be impossible or at least It must be impossible or at least
impractical to decipher a message if no impractical to decipher a message if no
other information is available. other information is available.

Q.9 Explain RSA in detail


Ans.
 It is the most common public key algorithm.
 This RSA name is get from its inventors first letter (Rivest (R), Shamir (S) and Adleman
(A)) in the year 1977.
 The RSA scheme is a block cipher in which the plaintext & ciphertext are integers
between 0 and n-1 for some ‘n’.
 A typical size for ‘n’ is 1024 bits or 309 decimal digits. That is, n is less than 21024

Description of the Algorithm:

 RSA algorithm uses an expression with exponentials.


 In RSA plaintext is encrypted in blocks, with each block having a binary value less
than some number n. that is, the block size must be less than or equal to log2(n)
 RSA uses two exponents ‘e’ and ‘d’ where epublic and dprivate.
 Encryption and decryption are of following form, for some PlainText ‘M’ and
CipherText block ‘C’

M=Cd mod = (Me mod n) d mon n =(Me)d mod n= Med mod n

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 4


WWW.UPTUNOTES.COM

Both sender and receiver must know the value of n.


The sender knows the value of ‘e’ & only the reviver knows the value of ‘d’ thus this is a
public key encryption algorithm with a
Public key PU={e, n}
Private key PR={d, n}

The ingredients of RSA algorithm are as follows:


1. p, q, two prime numbers private, chosen
2. n= pq public, calculated
3. e, with gcd (e , ø(n))=1 , Where 1<e<ø(n) public, chosen
4. d ≡ e-1 mod ø(n) private, calculated

RSA Key generation:

Each user generates a public/private key pair by:


1. Select p , q p and q are prime numbers , p is not equal to q
2. Calculate n = p * q
3. Calculate ø(n)=(p-1)(q-1)
4. Select integer e
gcd (e , ø(n))=1 , Where 1<e<ø(n)
5. Calculate d
d ≡ e-1 mod ø(n)
6. Public key: KU={e , n}
7. Private key: KR={d , n}

RSA Encryption and decryption:


 Encryption:
Plaintext:M<n
Ciphertext: C=Me mod N
Decryption:
. Ciphertext: C
Plaintext:M=Cd mod N

RSA example:
1. Select primes: p=17 & q=11
2. Compute n = pq =17×11=187
3. Compute ø(n)=(p–1)(q-1)=16×10=160
4. Select e : gcd (e,160)=1; choose e=7
5. Determine d:
d ≡ e-1 mod ø(n)
d ≡ 7-1 mod 160 = 23 (Using EEA)
6. Publish public key KU={7,187}
7. Private key KR={23,187}
Given message M = 88
Encryption:
C = 887 mod 187 = 11

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 5


WWW.UPTUNOTES.COM
Decryption:
M = 1123 mod 187 = 88

Q.10 Using RSA algorithm solve: let p= 17, q=11, e=7 and d=23. Calculate the public key
& private key and show encryption and decryption for plain text M= 88 by using RSA
algorithm.

Ans . Step 1: p=17 and q=11


Step 2: n=p*q = 17*11 = 187
Step 3 : ϕ= (p-1)(q-1) = (17-1)(11-1) = 16*10 = 160
Step 4: Let e= 17
Step 5 : d=7-1 mod 160

• Initially A1=1, A2=0,A3= ϕ(n),B1=0,B2=1,B3=e 17


• Q=A3/B3
• B3=A3%B3, A1=B1
• B1= A1-Q*B1, A2=B2
• B2=A2-Q*B2 , A3=B3

Q A1 A2 A3 B1 B2 B3
1 0 160 0 1 17
9 0 1 17 1 -9 7
2 1 -9 7 -2 19 3
2 -2 19 3 5 -47 1

Therefore d= ϕ(n)+ (-47) = 160+(-47) = 113


Public key= (e,n) =(17,187)
Private key = (d,n) = (113,187)
M= 88
C=Me mod n
= 8817 mod 187
e = 17= 10001 (binary )
y=y*a mod n
a=a*a mod n
Initially y=1 and a= M
Xi y= 1 a= M=88
1
0
0
0
1

C=

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 6


WWW.UPTUNOTES.COM

Q.11 Perform encryption and decryption using RSA Algorithm for the following.
I P=7; Q=11; e= l3; M=2.

Ans. Step 1: p=7 and q=11


Step 2: n=p*q = 11*7 = 77
Step 3 : ϕ= (p-1)(q-1) = (7-1)(11-1) = 6*10 = 60
Step 4: Let e= 13
Step 5 : d=13-1 mod 60

• Initially A1=1, A2=0,A3= ϕ(n),B1=0,B2=1,B3=e


• Q=A3/B3
• B3=A3%B3, A1=B1
• B1= A1-Q*B1, A2=B2
• B2=A2-Q*B2 , A3=B3

Q A1 A2 A3 B1 B2 B3
1 0 ϕ(n)=60 0 1 e=13
4 0 1 13 1 -4 8
1 1 -4 8 -1 5 5
1 -1 5 5 2 -9 3
1 2 -9 3 -3 14 2
1 -3 14 2 5 -23 1

Therefore d= ϕ(n)+(-23) = 60+(-23) = 37


M=2
C=Me mod n
= 213 mod 77
e = 13 (binary 1101)
y=y*a mod n
a=a*a mod n
Initially y=1 and a= M

Xi y= 1 a= M=2

1 2 4

0 2 16

1 32 16
1 30

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 7


WWW.UPTUNOTES.COM
C=30

Q.12 Explain the security of RSA ?

Ans.The Security of RSA :Four possible approaches to attacking the RSA algorithm are

1. Brute force: This involves trying all possible private keys.


2. Mathematical attacks: There are several approaches, all equivalent in effort to
factoring the product of two primes.
3. Timing attacks: These depend on the running time of the decryption algorithm.
4. Chosen ciphertext attacks: This type of attack exploits properties of the RSA
algorithm.

Q.13 Explain Diffle –Hellman key exchange algorithm.


Ans.
1. Diffie-Hellman key exchange is the first published public key algorithm
2. This Diffie-Hellman key exchange protocol is also known as exponential key
agreement. And it is based on mathematical principles.
3. The purpose of the algorithm is to enable two users to exchange a key securely that
can then be used for subsequent encryption of messages.
4. This algorithm itself is limited to exchange of the keys.
5. This algorithm depends for its effectiveness on the difficulty of computing discrete
logarithms.
6. The discrete logarithms are defined in this algorithm in the way of define a primitive
root of a prime number. Primitive root: we define a primitive root of a prime number
P as one whose power generate all the integers form 1 to P-1 that is if ‘a’ is a
primitive root of the prime number P, then the numbers
are distinct and consist of
the integers form 1 through P-1 in some permutation.For any integer ‘b’ and ‘a’, here
‘a’ is a primitive root of prime number P, then b≡ ai mod P 0 ≤ i ≤ (P-1)
The exponent i  is refer as discrete logarithm or index of b for the base a, mod P.
The value denoted as ind a,p(b)

Algorithm for Diffie-Hellman Key Exchange:

Step 1 two public known numbers q, α


q Prime number
α primitive root of q and α< q.
Step 2  if A & B users wish to exchange a key
a) User A select a random integer XA<q and computes
b) User B independently select a random integer XB <q and computes

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 8


WWW.UPTUNOTES.COM
c) Each side keeps the X value private and Makes the Y value available publicly to the
outer side.

Step 3 User A Computes the key as

User B Computes the key as


Step 4 two calculation produce identical results

(We know that )

(We know that )


The result is that the two sides have exchanged a secret key.

Example :

Users Alice & Bob who wish to swap keys:


  Choose q=353 and α=3

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 9


WWW.UPTUNOTES.COM
 Select random secret keys:
 A chooses xa=97
B chooses xb=233
 Compute public keys:
Ya=397 mod 353 = 40 (Alice)

 Compute shared session key as:


K= ybxa mod 353 = 24897mod 353= 160 (Alice)
K= yaxb mod 353 = 40233mod 353= 160 (Bob)

Q.14 Using Diffie Hellman key exchange method. Let q = 353, α=3, XA= 97 and XB = 233.
Then Compute YA,YB,KA& KB using Diffie Hellman.

Ans.

Q.15 The two entities A and B use the Diffie-Hellman primitive root α= 13 .
I. If user A private key 5 what is A’s public key?
II. If user B private key 12 what is B’s public.
III. What is shared key?

Ans.

Q.16 Find GCD(1970, 1066) by using Euclid’s Algorithm.

Ans Step 1. Divide the larger number by the smaller one:


1,970 ÷ 1,066 = 1 + 904;

Step 2. Divide the smaller number by the above operation's remainder:


1,066 ÷ 904 = 1 + 162;

Step 3. Divide the remainder from the step 1 by the remainder from the step 2:
904 ÷ 162 = 5 + 94;

Step 4. Divide the remainder from the step 2 by the remainder from the step 3:
162 ÷ 94 = 1 + 68;

Step 5. Divide the remainder from the step 3 by the remainder from the step 4:
94 ÷ 68 = 1 + 26;

Step 6. Divide the remainder from the step 4 by the remainder from the step 5:
68 ÷ 26 = 2 + 16;

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 10


WWW.UPTUNOTES.COM

Step 7. Divide the remainder from the step 5 by the remainder from the step 6:
26 ÷ 16 = 1 + 10;

Step 8. Divide the remainder from the step 6 by the remainder from the step 7:
16 ÷ 10 = 1 + 6;

Step 9. Divide the remainder from the step 7 by the remainder from the step 8:
10 ÷ 6 = 1 + 4;

Step 10. Divide the remainder from the step 8 by the remainder from the step 9:
6 ÷ 4 = 1 + 2;

Step 11. Divide the remainder from the step 9 by the remainder from the step 10:
4 ÷ 2 = 2 + 0;

At this step, the remainder is zero, so we stop: 2 is the number we were looking for, the last
remainder that is not zero. This is the greatest common factor (divisor).Greatest (highest)
common factor (divisor)gcf, gcd (1,970; 1,066) = 2;

Q.17 Compute the value of 517 mod 11 & 1117 mod 5.

Ans. 517 mod 11

y=y*a mod n a= a*a mod n


Xi y= 1 a= 5
1 5*1 mod 11 = 5 5*5 mod 11 = 3
0 5*3 mod 11 = 4 3*3 mod 11= 9
0 4*9 mod 11= 3 9*9 mod 11 = 4
0 4*3 mod 11 = 1 4*4 mod 11 = 5
1 1*5 mod 11 = 5 5*5 mod 11 = 25

517 mod 11 = 5 (Ans)

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 11


WWW.UPTUNOTES.COM
1117 mod 5

y=y*a mod n a= a*a mod n


Xi y= 1 a= 11
1 1*11 mod 5 = 1 11*11 mod 5 =1
0 1*1 mod 5 = 1 1*1 mod 5 = 1
0 1*1 mod 5 = 1 1*1 mod 5 = 1
0 1*1 mod 5 = 1 1*1 mod 5 = 1
1 1*1 mod 5 = 1 1*1 mod 5 = 1

1117 mod 5 = 1(Ans)

Q.18 Explain Euler’s Totient.

Ans. ø(n)is the number of positive integers less than n and relatively prime to n. Consists of
reduced set of residues, those that are numbers (residues) which are relatively prime to n

For a prime number p, ø(p) = p-1

Suppose if we have two prime numbers p and q, then n = pq

ø(n) = ø(pq) = ø(p) * ø(q) = (p-1) (q-1)

Determine ø(21)
ø(21) = ø(3) * ø(7)

= (3-1) (7-1)
=2 * 6
=12

The 12 integers are {1,2,4,5,8,10,11,13,16,17,19,20}

Q.19 Find the value of Euler’s Totient Number from 1 to 20 .

Ans.
n 1 2 3 4 5 6 7 8 9 10

φ(n) 1 1 2 2 4 2 6 4 6 4

n 11 12 13 14 15 16 17 18 19 20

φ(n) 10 4 12 6 8 8 16 6 18 8

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 12


WWW.UPTUNOTES.COM
Q.20 What is primality testing?

Ans. Testing of Primality:


 In cryptographic algorithms, it is necessary to select one or more prime numbers at
random.
 Task is to determine, whether the given large number is prime.
 A test based on Fermat’s Theorem called Miller Rabin Algorithm is used to test
whether the given number is prime or not.
 If Miller-Rabin returns “composite” the number is definitely not prime
 Otherwise is a prime

TEST (n) is:

1. Find integers k, q, k > 0, q odd, so that (n–1)=2kq


2. Select a random integer a, 1<a<n–1
3. if aq mod n = 1 then return (“inconclusive");
4. for j = 0 to k – 1 do
if (a2jq mod n = n-1)
then return("inconclusive ")
5. return ("composite")

Eg:
TEST (29)
1. n-1 29-1 =28
k, q = 2kq 2,7 = 22 (7)
2. If a =10
3. 107 mod 29 =17
4. (107 )2 mod 29 = 28

If a =2
2. 27 mod 29 =12
3. (27 )2 mod 29 = 28

Thus 29 is a prime number

Q.21 Explain the concept of primitive root.

Ans. Primitive root of a prime number p is the one whose powers generate all the integers from
1 to p-1.

If a is a primitive root of the prime number p, then the numbers

a mod p, a2 mod p, ....ap-1 mod p

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 13


WWW.UPTUNOTES.COM

By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 14


2018-19 [ KRISHNA INSTITUTE OF TECHNOLOGY]

Eg: Find the primitive root 7

Primitive roots of 7 = 3 and 5

Q.23 What do you understand by Chinese Remainder Theorem? Solve the following
congruent equations by Chinese remainder theorem:
i. X ≡ 2 mod 3
ii. X ≡ 3 mod 5
ii. X ≡ 2 mod7

Ans.

Q.24 Explain Finite field of the form GF (p) & GF (2n ) with suitable example.

Ans. Finite fields play a key role in cryptography. It can show number of elements in a finite
field must be a power of a prime pn and it is known as Galois fields, denoted GF(pn).

In particular often use the fields:


a. GF(p)
b. GF(2n)

GF(p) is the set of integers {0,1, … , p-1} with arithmetic operations modulo prime p ,these form
a finite field
 since have multiplicative inverses
 find inverse with Extended Euclidean algorithm

Hence arithmetic is “well-behaved” and can do addition, subtraction, multiplication, and division
without leaving the field GF(p).

RUCHI KHETAN
ASST PROFESSOR CSE DEPTT
2018-19 [ KRISHNA INSTITUTE OF TECHNOLOGY]

Q.25 Explain the greatest common divisor.

Ans. Polynomial arithmetic over a field and integer arithmetic by defining the greatest common
divisor as follows. The polynomial c(x) is said to be the greatest common divisor of a(x) and b(x)
if the following are true.

 c(x) divides both a(x) and b(x).

 Any divisor of a(x) and b(x) is a divisor of c(x).

An equivalent definition is the following: gcd[a(x), b(x)] is the polynomial of maximum degree
that divides both a(x) and b(x).

Q.26 Explain the Extended Euclidean algorithm.

Ans. It calculates not only GCD but x & y: ax + by = d = gcd(a, b)

 It is useful for later crypto computations


 It follow sequence of divisions for GCD but assume at each step i, can find x &y:
r = ax + by
 At end find GCD value and also x & y

RUCHI KHETAN
ASST PROFESSOR CSE DEPTT
2018-19 [ KRISHNA INSTITUTE OF TECHNOLOGY]

 if GCD(a,b)=1 these values are inverses

EXTENDED EUCLID(m, b)
1. (A1, A2, A3)=(1, 0, m);
(B1, B2, B3)=(0, 1, b)
2. if B3 = 0
return A3 = gcd(m, b); no inverse
3. if B3 = 1
return B3 = gcd(m, b); B2 = b–1 mod m
4. Q = A3 div B3
5. (T1, T2, T3)=(A1 – Q B1, A2 – Q B2, A3 – Q B3)
6. (A1, A2, A3)=(B1, B2, B3)
7. (B1, B2, B3)=(T1, T2, T3)
8. goto 2

Example: Inverse of 550 in GF(1759):

Q.27

Ans. If the modulus g(x) is an irreducible polynomial of degree m over GF(p), then the finite
field GF(pm) can be constructed by the set of polynomials over GF(p) whose degree is at most m-
1, where addition and multiplication are done modulo g(x).
For example, the finite field GF(32) can be constructed as the set of polynomials whose degrees
are at most 1, with addition and multiplication done modulo the irreducible polynomial x 2+1
(you can also choose another modulus, as long as it is irreducible and has degree 2).

Table Addition modulo x2+1

RUCHI KHETAN
ASST PROFESSOR CSE DEPTT
2018-19 [ KRISHNA INSTITUTE OF TECHNOLOGY]

+ 0 1 2 x x+1 x+2 2x 2x+1 2x+2

0 0 1 2 x x+1 x+2 2x 2x+1 2x+2

1 1 2 0 x+1 x+2 x 2x+1 2x+2 2x

2 2 0 1 x+2 x x+1 2x+2 2x 2x+1

x x x+1 x+2 2x 2x+1 2x+2 0 1 2

x+1 x+1 x+2 x 2x+1 2x+2 2x 1 2 0

x+2 x+2 x x+1 2x+2 2x 2x+1 2 0 1

2x 2x 2x+1 2x+2 0 1 2 x x+1 x+2

2x+1 2x+1 2x+2 2x 1 2 0 x x+2 x+2

2x+2 2x+2 2x 2x+1 2 0 1 x+2 x x+1

Table Multiplication modulo x2+1

+ 0 1 2 x x+1 x+2 2x 2x+1 2x+2

0 0 0 0 0 0 0 0 0 0

1 0 1 2 x x+1 x+2 2x 2x+1 2x+2

2 0 2 1 2x 2x+2 2x+1 x x+2 x+1

x 0 x 2x 2 x+2 2x+2 1 x+1 2x+1

x+1 0 x+1 2x+2 x+2 2x 1 2x+1 2 x

x+2 0 x+2 2x+1 2x+2 1 x x+1 2x 2

2x 0 2x x 1 2x+1 x+1 2 2x+2 x+2

RUCHI KHETAN
ASST PROFESSOR CSE DEPTT
2018-19 [ KRISHNA INSTITUTE OF TECHNOLOGY]

+ 0 1 2 x x+1 x+2 2x 2x+1 2x+2

2x+1 0 2x+1 x+2 x+1 2 2x 2x+2 x 1

2x+2 0 2x+2 x+1 2x+1 x 2 x+2 1 2x

RUCHI KHETAN
ASST PROFESSOR CSE DEPTT

You might also like