You are on page 1of 19

||Jai Sri Gurudev ||

Sri Adichunchanagiri Shikshana Trust®

SJB INSTITUTE OF TECHNOLOGY


Accredited by NBA & NAAC with ‘A’ Grade
No. 67, BGS Health & Education City, Dr. Vishnuvardhan Road
Kengeri, Bangalore – 560 060

Department of Electronics & Communication


Engineering
Cryptography [18EC744]

MODULE – 3: Basic Concepts of Number Theory and Finite Fields

Notes (as per VTU Syllabus)

VII SEMESTER – B. E

Academic Year: 2022 – 2023 (ODD)

Course Coordinator : Mrs. Uma S

Designation : Assistant Professor


Cryptography 18EC744

UNIVERSITY SYLLABUS
B. E. (EC / TC)
Choice Based Credit System (CBCS) and Outcome Based Education (OBE)
SEMESTER – IV
Subject Code 18EC744 CIE Marks 40
Number of Lecture Hours/Week 3 (Tutorial) SEE Marks 60
40 (08 Hours per
Total Number of Lecture Hours Exam Hours 03
Module)
CREDITS – 03
Course Learning Objectives: This course will enable students to:
 Understand the basics of symmetric key and public key cryptography.
 Explain classical cryptography algorithms.
 Acquire knowledge of mathematical concepts required for cryptography.
 Describe pseudo random sequence generation technique.
 Explain symmetric and asymmetric cryptography algorithms.
Modules RBT Level
Module -1
Classical Encryption Techniques: Symmetric cipher model, Substitution
techniques, Transposition techniques (Text 1: Chapter 1) Basic Concepts of
L1, L2
Number Theory and Finite Fields: Euclidean algorithm, Modular arithmetic (Text
1: Chapter 3)
Module - 2
SYMMETRIC CIPHERS: Traditional Block Cipher structure, Data encryption
standard (DES), The AES Cipher. (Text 1: Chapter 2: Section1, 2, Chapter L1, L2
4:Section 2, 3, 4)
Module - 3
Basic Concepts of Number Theory and Finite Fields: Groups, Rings and Fields,
Finite fields of the form GF(p), Prime Numbers, Fermat’s and Euler’s theorem, L1, L2
discrete logarithm. (Text 1: Chapter 3 and Chapter 7: Section 1, 2, 5)
Module - 4
ASYMMETRIC CIPHERS: Principles of Public-Key Cryptosystems, The RSA
algorithm, Diffie - Hellman Key Exchange, Elliptic Curve Arithmetic, Elliptic L1, L2,L3
Curve Cryptography (Text 1: Chapter 8, Chapter 9: Section 1, 3, 4)
Module - 5
Pseudo-Random-Sequence Generators and Stream Ciphers: Linear Congruential
L1, L2,L3
Generators, Linear Feedback Shift Registers, Design and analysis of stream

Dept. of ECE, SJBIT Page 2


Cryptography 18EC744

ciphers, Stream ciphers using LFSRs, A5, Hughes XPD/KPD, Nanoteq,


Rambutan, Additive generators, Gifford, Algorithm M,PKZIP (Text 2: Chapter
16)
Course Outcomes:
After studying this course, students will be able to:
• Explain basic cryptographic algorithms to encrypt and decrypt the data.
• Use symmetric and asymmetric cryptography algorithms to encrypt and decrypt the information.
• Apply concepts of modern algebra in cryptography algorithms.
• Apply pseudo random sequence in stream cipher algorithms.
Question paper pattern:
 Examination will be conducted for 100 marks with question paper containing 10 full
questions, each of 20 marks.
 Each full question can have a maximum of 4 sub questions.
 There will be 2 full questions from each module covering all the topics of the module.
 Students will have to answer 5 full questions, selecting one full question from each module.
 The total marks will be proportionally reduced to 60 marks as SEE marks is 60.
Text Books:
1. William Stallings , “Cryptography and Network Security Principles and Practice”, Pearson
Education Inc., 6th Edition, 2014, ISBN: 978-93-325-1877-3
2. Bruce Schneier, “Applied Cryptography Protocols, Algorithms, and Source code in C”, Wiley
Publications, 2nd Edition, ISBN: 9971-51-348-X.
Reference Books:
1. Cryptography and Network Security, Behrouz A. Forouzan, TMH, 2007.
2. Cryptography and Network Security, Atul Kahate, TMH, 2003.

Dept. of ECE, SJBIT Page 3


Cryptography 18EC744

INDEX SHEET
SL. PAGE
TOPIC
NO. NO.

VTU Syllabus 2

MODULE – 3

1 Groups, Rings and Fields 5

2 Finite fields of the form GF(p) 7

3 Prime Numbers. 9

6 Fermat’s and Euler’s theorem 11

7 discrete logarithm 14

8 Question Bank 19

Dept. of ECE, SJBIT Page 4


Cryptography 18EC744

Module-3

Basic Concepts of Number Theory and Finite Fields


Groups, Rings and Fields, Finite fields of the form GF(p), Prime Numbers, Fermat’s and
Euler’s theorem, discrete logarithm.

Groups, Rings, and Fields


Groups, rings, and fields are the fundamental elements of a branch of mathematicsknown
asabstract algebra, or modern algebra.
In abstract algebra, elements of a set are operated algebraically, that is combining two
elements of the set in several ways to obtain a third element of the set. These operations have
certain specific rules that define the nature of the set.
Groups
A group G, sometimes denoted by {G,}, is a set of elements with a binary operationdenoted
by  that associates to each ordered pair (a, b) of elements in G an element(a b) in G, such
that the following axioms are obeyed.

If a group has a finite number of elements, it is referred to as a finite group, andthe order
ofthe group is equal to the number of elements in the group. Otherwise,the group is an
infinite group.
A group is said to be abelian if it satisfies the following additional condition:

When the group operation is addition, the identity element is 0; the inverse elementof a is -
a;and subtraction is defined with the following rule: a - b = a + (-b).
Cyclic Group:
Cyclic Group is defined as exponentiation within a group as a repeated applicationof the
group operator, so that a3 = aa a.

Dept. of ECE, SJBIT Page 5


Cryptography 18EC744

Further, a0 = e as theidentity element, and a-n = (a′ ) n, where a′ is the inverse element of a
within thegroup. A group G is cyclic if every element of G is a power ak (k is an integer) ofa
fixed element a G. The element a is said to generate the group G or to be ageneratorof G.
A cyclic group is always abelian and may be finite or infinite.
Rings
A ring R, sometimes denoted by {R, +, *}, is a set of elements with two
binaryoperations,called addition and multiplication,6 such that for all a, b, c in R the
followingaxioms are obeyed.

A ring is said to be commutative if it satisfies the following additional condition:

Fields
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 followingaxioms
are obeyed.

Afield is a set in which we can do addition, subtraction, multiplication,and division


withoutleaving the set. Division is defined with the following rule:a/b = a (b-1).

Dept. of ECE, SJBIT Page 6


Cryptography 18EC744

Finite Fields of The Form GF(p)

Afield is defined as a set that obeys all of the axioms of Figure.

The set Zn of integers{0, 1,…………, n - 1}, together with the arithmetic operations modulo
n, is a commutative ring as in table below

Any integer in Zn has a multiplicativeinverse if and only if that integer is relatively prime to n
.

Dept. of ECE, SJBIT Page 7


Cryptography 18EC744

If n is prime, then all of the nonzero integers in Zn are relativelyprime to n, and therefore
there exists a multiplicative inverse for all of the nonzerointegers in Zn.
Thus, for Zp we can add the following properties to those listed in Table 4.3

The above table gives the additive inverse and multiplicative inverse also addition and
multiplication modulo 7.

Dept. of ECE, SJBIT Page 8


Cryptography 18EC744

To find additive inverse it is a+x = 0 (mod n)


Example: - here let a=1 then, a+x = 0 (mod 7) = 1+0 = 1 mod 7 is = -6
1+1 = 2 mod 7 is = -5
Similarly 1+6 = 7 mod 7 is = 0 …. So additive inverse
of 1 is 6
To find multiplicative inverse
Inverseelement for multiplication is 1 so , a*x = 1 (mod n)
Multiplicative inverse of 2 is = 2*1 = 2 mod 7 gives = -5, then 2*2 = 4 mod 7 gives -3, 2*3 =
6 mod 7 gives -1 , 2*4 gives 8mod 7 remainder is 1. Hence multiplicative inverse of 2 is 4.
Summary
It is learnt how to construct a finite field of order p, where p isprime. Specifically, we defined
GF(p) with the following properties.
1. GF(p) consists of p elements.
2. The binary operations + and * are defined over the set. The operations
ofaddition,subtraction, multiplication, and division can be performed withoutleaving the set.
Each element of the set other than 0 has a multiplicativeinverse.

Prime Numbers

An integer p >1 is a prime number if and only if its only divisors are ±1and ±p.
Primenumbers play a critical role in number theory.
Table 8.1 shows the primes less than 2000.

Dept. of ECE, SJBIT Page 9


Cryptography 18EC744

This is known as fundamental theorem of arithmetic.


91 can be written as 7*13 which is prime .
3600 = 16*9*25 = 24 * 32 *52
11011 = 7 * 112 * 13
This can be expressed in another way. If P is the set of all primenumbers, then any positive
integer a can be written uniquely in the following form:

The right-hand side is the product over all possible prime numbers p; for any
particularvalueof a, most of the exponents ap will be 0.
The value of any given positive integer can be specified by simply listing all thenonzero
exponents in the foregoing formulation.
The integer 12 is represented by 12 = 1a0 * 1a1 *2a2 * 3a3 {Let a0 = 0, a1 = 1 ,a2 = 2, a3 = 1}.
12 = 10 *11 *22 * 31
The integer 18 is represented by = 10 *11 *21 * 32

Dept. of ECE, SJBIT Page 10


Cryptography 18EC744

It is easy to determine the greatest common divisor of two positive integers, ifwe express
each integer as the product of primes.

Determining the prime factors of a large number is no easy task, so the precedingrelationship
does not directly lead to a practical method of calculating thegreatest common divisor.

Fermat’s and Euler’s Theorems


Two theorems that play important roles in public-key cryptography are :
1. Fermat’s theorem and
2. Euler’s theorem.
Fermat’s Theorem
Fermats theorem is also called as FermatsLittle theorem
Fermat’s theorem states that, If p is prime and a is a positive integer notdivisible by p, then

---------------------------------------- 1
PROOF: Let S be the set of integers S= {1,2,3,………….p-2,p-1, p}.
Now consider the set of positive integers less than pi.e {1,2,3, ………… , p-1}.
Multiply each element by positive integer a, modulo p to get the new set X.
X = {a,2a,3a, ………. a(p-1)}mod p = {a mod p, 2a mod p, …………, (p-1)a modp}.
None of the elements of X is equal to zero becausea is not divisible by p.
No two of the integers in X are equal.
Assume that ja≡ ka (mod p)), where 1 … j 6 k … p - 1. Because a is relativelyprime to p, we
can eliminate a from both sides of the equationresulting in j≡ k (mod p).
This last equality is impossible, because j and k are bothpositive integers less than p.
Therefore, we know that the X consists of (p - 1) elements,are all positive integers with no
two elements equal.
We can conclude, the X consistsof the set of integers {1, 2…p - 1} in some order.
Multiplying the numbers inboth sets (p and X) and taking the result mod p yields

Dept. of ECE, SJBIT Page 11


Cryptography 18EC744

We can cancel the (p - 1)! Term because it is relatively prime to p. Hence completes the
proof.
Example: Prove Fermats theorem holds well for a = 7, p = 19.

An alternative form of Fermat’s theorem is also useful: If p is prime and a is apositive


integer, then

------------------------------------------------ 2
Note that the first form of the theorem [Equation (1)] requires that a be relativelyprime to p,
but this form does not.

Euler’s Totient Function

Before presenting Euler’s theorem, one important quantity in number theory is Euler’s totient
function written ϕ(n), defined asthe number of positive integers less than n and relatively
prime to n. By convention,f(1) = 1.

Dept. of ECE, SJBIT Page 12


Cryptography 18EC744

Table 8.2 lists the first 30 values of ϕ(n).


The value ϕ(1) is without meaningbut is defined tohave the value 1.It should be clear that, for
a prime number p,ϕ(p) = p – 1 .
Suppose we have two prime numbers p and q with p _ q. Then we canshow that, for n = pq,

Euler’s Theorem

Euler’s theorem states that for every a and n that are relatively prime:

Proof: Equation (8.4) is true if n is prime, because in that case, ϕ(n) = (n - 1)and Fermat’s
theorem holds.
However, it also holds for any integer n. ϕ(n) is the number of positive integers less than n
that are relatively prime to n.Consider the set of such integers, labeled as

Dept. of ECE, SJBIT Page 13


Cryptography 18EC744

That is, each element xi of R is a unique positive integer less than n with gcd(xi, n) = 1.Now
multiply each element by a, modulo n:

The set S is a permutationof R, by the following line of reasoning:


1. Because a is relatively prime to n and xi is relatively prime to n, axi must alsobe relatively
prime to n. Thus, all the members of S are integers that are lessthan n and that are relatively
primeto n.
2. There are no duplicates in S. Refer to Equation (4.5). If axi mod n= axj mod n, then xi = xj.

Discrete Logarithm
Discrete logarithms are fundamental to a number of public-key algorithms, including Diffie-
Hellman key exchange and the digital signature algorithm (DSA).
The Powers of an Integer, Modulo n
For every a and n that are relatively prime

Dept. of ECE, SJBIT Page 14


Cryptography 18EC744

If a and n are relatively prime, then there is at least one integer m that satisfies the above
equation. namely, M = Φ(n). The least positive exponent m for which the above equation
holds is referred to in several ways
 The order of a (mod n)
 The exponent to which a belongs (mod n)
 The length of the period generated by a

Table below shows all the powers of a, modulo 19 for all positive a 6 19. The length of the
sequence for each base value is indicated by shading. Note the following:
1. All sequences end in 1. This is consistent with the reasoning of the preceding few
paragraphs.
2. The length of a sequence divides f(19) = 18. That is, an integral number of sequences occur
in each row of the table.
3. Some of the sequences are of length 18. In this case, it is said that the base integer a
generates (via powers) the set of nonzero integers modulo 19. Each such integer is called a
primitive root of the modulus 19.

Dept. of ECE, SJBIT Page 15


Cryptography 18EC744

More generally, we can say that the highest possible exponent to which a number can belong
(mod n) is f(n). If a number is of this order, it is referred to as a primitive root of n. The
importance of this notion is that if a is a primitive root of n, then its powers

Logarithms for Modular Arithmetic


With ordinary positive real numbers, the logarithm function is the inverse of exponentiation.
An analogous function exists for modular arithmetic. Let us briefly review the properties of
ordinary logarithms. The logarithm of a number is defined to be the power to which some
positive base (except 1) must be raised in order to equal the number. That is, for base x and
for a value y,

Dept. of ECE, SJBIT Page 16


Cryptography 18EC744

Dept. of ECE, SJBIT Page 17


Cryptography 18EC744

Table which is directly derived from Table 8.3, shows the sets of discrete logarithms that can
be defined for modulus 19
Calculation of Discrete Logarithms
Consider the equation

Given g, x, and p, it is a straightforward matter to calculate y. At the worst, we must perform


x repeated multiplications, and algorithms exist for achieving greater efficiency However,
given y, g, and p, it is, in general, very difficult to calculate x (take the discrete logarithm).
The difficulty seems to be on the same order of magnitude as that of factoring primes
required for RSA. At the time of this writing, the asymptotically fastest known algorithm for
taking discrete logarithms modulo a prime number is on the order of [BETH91]:

Dept. of ECE, SJBIT Page 18


Cryptography 18EC744

Recommended Questions
1. Explain Groups, Rings and Fields.
2. Explain Finite Fields of The Form GF(p).
3. Explain Fermat’s theorem.
4. Expalin Euler’s theorem.
5. Explain Discrete Logarithm.
6. With an example explain Logarithms for Modular Arithmetic.

Dept. of ECE, SJBIT Page 19

You might also like