0% found this document useful (0 votes)
79 views88 pages

3 Mathematics of Cryptography

Uploaded by

aryav goyal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views88 pages

3 Mathematics of Cryptography

Uploaded by

aryav goyal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 88

CS 3202: INFORMATION SYSTEMS

SECURITY

INTRODUCTION
VISION-MISSION DEPARTMENT

VISION
❖TO ACHIEVE EXCELLENCE IN COMPUTER SCIENCE &
ENGINEERING EDUCATION FOR GLOBAL COMPETENCY WITH
HUMAN VALUES

MISSION
❖PROVIDE INNOVATIVE ACADEMIC & RESEARCH ENVIRONMENT
TO DEVELOP COMPETITIVE ENGINEERS IN THE FIELD OF
COMPUTER SCIENCE AND ENGINEERING.
❖DEVELOP PROBLEM-SOLVING & PROJECT MANAGEMENT SKILLS
BY STUDENT CENTRIC ACTIVITIES & INDUSTRY
COLLABORATION.
❖NURTURE THE STUDENTS WITH SOCIAL & ETHICAL VALUES
INTRODUCTION

❖THIS COURSE IS OFFERED BY DEPT. OF COMPUTER SCIENCE, THE


AIM OF THE COURSE TO PROVIDE THE STUDENTS BASIC
BACKGROUND ON INFORMATION SYSTEMS.
❖THIS IS TARGETING STUDENTS WHO WISH TO PURSUE CAREER IN
THE FIELD OF INFORMATION SECURITY. THE COURSE INCLUDES
UNDERSTANDING THE PRINCIPLES FOR MULTI-LAYER SECURITY
AND MANAGEMENT SYSTEMS FOR THE NETWORK. THE FOCUS IS
ON TECHNIQUES AND PROTOCOL USED FOR DIFFERENT TYPES OF
SECURITY POLICIES.
COURSE OUTCOME
• [CS 3101.1] ILLUSTRATE THE CONCEPT OF INFORMATION SYSTEM AND
CLASSICAL CRYPTOGRAPHY.

• [CS 3101.2] APPLY THE CONCEPTS OF CIPHER ALGORITHMS WITH


MATHEMATICAL STANDARDS.

• [CS 3101.3] MAKE USE OF PUBLIC KEY ENCRYPTION WITH KEY EXCHANGE
FUNDAMENTALS.

• [CS 3101.4] DEMONSTRATE AUTHENTICATION MANAGEMENT AND ITS


RELEVANT ISSUES.

• [CS 3101.5] INFER THE APPLICATIONS OF CRYPTOGRAPHY FOR INFORMATION


SYSTEMS.
PROGRAM OUTCOME
• [PO.1]. ENGINEERING KNOWLEDGE: APPLY THE KNOWLEDGE OF MATHEMATICS,
COMPUTER SCIENCE, AND COMMUNICATION ENGINEERING FUNDAMENTALS TO THE
SOLUTION OF COMPLEX ENGINEERING PROBLEMS.

• [PO.2]. PROBLEM ANALYSIS: THE SOPHISTICATED CURRICULUM WOULD ENABLE A


GRADUATE TO IDENTIFY, FORMULATE, REVIEW RESEARCH LITERATURE, AND ANALYSES
COMPLEX ENGINEERING PROBLEMS REACHING SUBSTANTIATED CONCLUSIONS USING
BASIC PRINCIPLES OF MATHEMATICS, COMPUTING TECHNIQUES AND COMMUNICATION
ENGINEERING PRINCIPLES.

• [PO.3]. DESIGN/DEVELOPMENT OF SOLUTIONS: UPON ANALYZING, THE B. TECH CCE


GRADUATE SHOULD BE ABLE TO DEVISE SOLUTIONS FOR COMPLEX ENGINEERING
PROBLEMS AND DESIGN SYSTEM COMPONENTS OR PROCESSES THAT MEET THE SPECIFIED
REQUIREMENTS WITH APPROPRIATE CONSIDERATION FOR LAW, SAFETY, CULTURAL &
SOCIETAL OBLIGATIONS WITH ENVIRONMENTAL CONSIDERATIONS
PROGRAM OUTCOME
• [PO.4]. CONDUCT INVESTIGATIONS OF COMPLEX PROBLEMS: TO IMBIBE THE INQUISITIVE
PRACTICES TO HAVE THRUST FOR INNOVATION AND EXCELLENCE THAT LEADS TO USE
RESEARCH-BASED KNOWLEDGE AND RESEARCH METHODS INCLUDING DESIGN OF
EXPERIMENTS, ANALYSIS AND INTERPRETATION OF DATA, AND SYNTHESIS OF THE
INFORMATION TO PROVIDE VALID CONCLUSIONS.

• [PO.5]. MODERN TOOL USAGE: CREATE, SELECT, AND APPLY APPROPRIATE TECHNIQUES,
RESOURCES, AND MODERN ENGINEERING AND IT TOOLS INCLUDING PREDICTION AND
MODELLING TO COMPLEX ENGINEERING ACTIVITIES WITH AN UNDERSTANDING OF THE
LIMITATIONS.

• [PO.6]. THE ENGINEER AND SOCIETY: THE ENGINEERS ARE CALLED SOCIETY BUILDERS AND
TRANSFORMERS. B. TECH CCE GRADUATE SHOULD BE ABLE TO APPLY REASONING
INFORMED BY THE CONTEXTUAL KNOWLEDGE TO ASSESS SOCIETAL, HEALTH, SAFETY,
LEGAL AND CULTURAL ISSUES AND THE CONSEQUENT RESPONSIBILITIES RELEVANT TO THE
PROFESSIONAL ENGINEERING PRACTICE.
PROGRAM OUTCOME
• [[PO.7]. ENVIRONMENT AND SUSTAINABILITY: THE ZERO EFFECT AND ZERO DEFECT IS NOT
JUST A SLOGAN, IT IS TO BE PRACTICED IN EACH ACTION. THUS, A B. TECH. CCE SHOULD
UNDERSTAND THE IMPACT OF THE PROFESSIONAL ENGINEERING SOLUTIONS IN SOCIETAL
AND ENVIRONMENTAL CONTEXTS, AND DEMONSTRATE THE KNOWLEDGE OF, AND NEED
FOR SUSTAINABLE DEVELOPMENT.
• [PO.8]. ETHICS: PROTECTION OF IPR, STAYING AWAY FROM PLAGIARISM ARE IMPORTANT.
STUDENT SHOULD BE ABLE TO APPLY ETHICAL PRINCIPLES AND COMMIT TO PROFESSIONAL
ETHICS, RESPONSIBILITIES AND NORMS OF THE ENGINEERING PRACTICE.
• [PO.9]. INDIVIDUAL AND TEAMWORK: UNITED WE GROW, DIVIDED WE FALL IS A CULTURE
AT MUJ. THUS, AN OUTGOING STUDENT SHOULD BE ABLE TO FUNCTION EFFECTIVELY AS
AN INDIVIDUAL, AND AS A MEMBER OR LEADER IN DIVERSE TEAMS, AND IN
MULTIDISCIPLINARY SETTINGS.
• [PO.10]. COMMUNICATION: COMMUNICATE EFFECTIVELY FOR ALL ENGINEERING
PROCESSES & ACTIVITIES WITH THE PEER ENGINEERING TEAM, COMMUNITY AND WITH
SOCIETY AT LARGE. CLARITY OF THOUGHTS, BEING ABLE TO COMPREHEND AND
FORMULATE EFFECTIVE REPORTS AND DESIGN DOCUMENTATION, MAKE EFFECTIVE
PRESENTATIONS, AND GIVE AND RECEIVE CLEAR INSTRUCTIONS
PROGRAM OUTCOME
• [PO.11]. PROJECT MANAGEMENT AND FINANCE: DEMONSTRATE KNOWLEDGE AND
UNDERSTANDING OF THE ENGINEERING AND MANAGEMENT PRINCIPLES AND APPLY THESE
TO ONE’S OWN WORK, AS A MEMBER AND LEADER IN A TEAM, TO MANAGE PROJECTS
AND IN VARIED ENVIRONMENTS.

• [PO.12]. LIFE-LONG LEARNING: RECOGNIZE THE NEED FOR AND HAVE THE PREPARATION
AND ABILITY TO ENGAGE IN INDEPENDENT AND LIFE-LONG LEARNING IN THE BROADEST
CONTEXT OF TECHNOLOGICAL CHANGE.
2.1.1 Set of Integers

The set of integers, denoted by Z, contains all integral


numbers (with no fraction) from negative infinity to
positive infinity (Figure 2.1).

Figure 2.1 The set of integers

2.9
2.1.2 Binary Operations
In cryptography, we are interested in three binary
operations applied to the set of integers. A binary
operation takes two inputs and creates one output.

Figure 2.2 Three binary operations for the set of integers

2.10
2.1.2 Continued
Example 2.1

The following shows the results of the three binary operations


on two integers. Because each input can be either positive or
negative, we can have four cases for each operation.

2.11
2.1.3 Integer Division

In integer arithmetic, if we divide a by n, we can get q


And r . The relationship between these four integers can
be shown as

a=q×n+r

2.12
2.1.3 Continued
Example 2.2
Assume that a = 255 and n = 11. We can find q = 23 and R = 2
using the division algorithm.

Figure 2.3 Example 2.2, finding the quotient and the remainder

2.13
2.1.3 Two Restrictions for Cryptography
Figure 2.4 Division algorithm for integers

We impose two restrictions. First, we require that the divisor be a positive integer
(n>0). Second, we require that the remainder be a non-negative integer (r>=0).

2.14
2.1.3 Continued
Example 2.3
When we use a computer or a calculator, r and q are negative
when a is negative. How can we apply the restriction that r
needs to be positive? The solution is simple, we decrement the
value of q by 1 and we add the value of n to r to make it
positive.

255 = 23 * 11 + 2

2.15
2.1.3 Continued
Figure 2.5 Graph of division alogorithm

Start from zero, the graph shows how we can reach the point representing the integer a on the
line.
• In case of a positive ‘a’, we need to move q*n units to the right and then move extra r units
in the same direction.
• In case of a negative ‘a’ , we need to move (q-1)*n units to the left (q is negative in this
case) and then move r units in the opposite direction. In both cases, the value of r is positive.

2.16
2.1.4 Divisbility

If a is not zero and we let r = 0 in the division relation,


we get

a=q×n

If the remainder is zero, We are not interested in q,

If the remainder is not zero,

2.17
2.1.4 Continued
Example 2.4

a. The integer 4 divides the integer 32 because 32 = 8 × 4. We


show this as

b. The number 8 does not divide the number 42 because


42 = 5 × 8 + 2. There is a remainder, the number 2, in the
equation. We show this as

2.18
2.1.4 Continued
Example 2.5

2.19
2.1.4 Continued
Properties

Property 1: if a|1, then a = ±1.

Property 2: if a|b and b|a, then a = ±b.

Property 3: if a|b and b|c, then a|c.

Property 4: if a|b and a|c, then


a|(m × b + n × c), where m
and n are arbitrary integers

2.20
2.1.4 Continued
Example 2.6

2.21
2.1.4 Continued

Note

Fact 1: The integer 1 has only one


divisor, itself.

Fact 2: Any positive integer has at least


two divisors, 1 and itself (but it
can have more).

2.22
2.1.4 Continued
Figure 2.6 Common divisors of two integers

One integer often needed in cryptography is the greatest common divisor of two positive
integers. Two positive integers may have many common divisors, but only one greatest common
divisor.

2.23
2.1.4 Continued

Note Greatest Common Divisor

The greatest common divisor of two


positive integers is the largest integer
that can divide both integers.

2.24
Euclidean Algorithm
Euclid developed an algorithm to find the GCD of two positive integers.

Fact 1: gcd (a, 0) = a


Fact 2: gcd (a, b) = gcd (b, a mod b), till
we get fact 1.

2.25
2.1.4 Continued
Figure 2.7 Euclidean Algorithm

2.26
2.1.4 Continued

Note

When gcd (a, b) = 1, we say that a and b


are relatively prime.

2.27
2.1.4 Continued
Example 2.7
Find the greatest common divisor of 2740 and 1760.
Solution
We have gcd (2740, 1760) = 20.

2.28
2.1.4 Continued
Example 2.8
Find the greatest common divisor of 25 and 60.

Solution
We have gcd (25, 65) = 5.

2.29
2.1.4 Continued
Extended Euclidean Algorithm
Given two integers a and b, we often need to find other two
integers, s and t, such that

The extended Euclidean algorithm can calculate the gcd (a, b)


and at the same time calculate the value of s and t.

2.30
2.1.4 Continued
Figure 2.8.a Extended Euclidean algorithm, part a

2.31
2.1.4 Continued
Figure 2.8.b Extended Euclidean algorithm, part b

2.32
2.1.4 Continued
Example 2.9

Given a = 161 and b = 28, find gcd


(a, b) and the values of s and t.
Solution We get gcd (161, 28) = 7,
s = −1 and t = 6.

S = S1 – q*S2; t = t1 – q*t2

2.33
2.1.4 Continued
Example 2.10
Given a = 17 and b = 0, find gcd
(a, b) and the values of s
and t.
Solution
We get gcd (17, 0) = 17, s = 1, and t = 0.

2.34
2.1.4 Continued
Example 2.11

Given a = 0 and b = 45, find gcd (a, b)


and the values of s and t.
Solution
We get gcd (0, 45) = 45, s = 0, and t = 1.

2.35
2.1.4 Continued
Linear Diophantine Equation

We need to find integer values for x and y that satisfy the equation. This type of equation has
either no solution or an infinite number of solutions. Let d = gcd(a,b). If d not divisible by c, then
equation has no solution. If d|c, then we have an infinite number of solutions. One of them is
called particular; the rest are general.

Note

A linear Diophantine equation of two


variables is ax + by = c.

Where a and b not equal to 0. a, b, c = Z

2.36
2.1.4 Continued
Linear Diophantine Equation

Note

Particular solution:
x0 = (c/d)s and y0 = (c/d)t

If d|c, a particular solution to the above equation can be found


using the following steps:
1. Reduce the equation to a1x + b1y = c1 by dividing both sides
of the equation by d. This is possible because d divides a, b, and
c by assumption.
2. Solve for s and t in the relation a1s + b1t = 1 using the
extended Euclidean algorithm.
3. The particular solution can be found.
2.37
2.1.4 Continued
Linear Diophantine Equation

After finding the particular solution, the general solutions can be


found

Note

General solutions:
x = x0 + k (b/d) and y = y0 − k(a/d)
where k is an integer
2.38
2.1.4 Continued
Example 2.12
Find the particular and general solutions to the equation
21x + 14y = 35.
Solution: We have d = gcd(21, 14) = 7. Since 7|35, the equation has an
infinite number of solutions. We can divide both sides by 7 to find the
equation 3x + 2y = 5. Using the extended Euclidean algorithm, we find s
and t such as 3s +2t = 1 . We have s =1, t = -1.

For particular, since 35/7 = 5


For general, where k is an integer.
Thererfore, the solutions are (5, -5), (7, -8), (9, -11)…….

2.39
2-2 MODULAR ARITHMETIC

The division relationship (a = q × n + r) discussed in the


previous section has two inputs (a and n) and two outputs
(q and r). In modular arithmetic, we are interested in
only one of the outputs, the remainder r.

Topics discussed in this section:


2.2.1 Modular Operator
2.2.2 Set of Residues
2.2.3 Congruence
2.2.4 Operations in Zn
2.2.5 Addition and Multiplication Tables
2.2.6 Different Sets
2.40
2.2.1 Modulo Operator

The modulo operator is shown as mod. The second input


(n) is called the modulus. The output r is called the
residue.
Figure 2.9 Division algorithm and modulo operator

2.41
2.1.4 Continued
Example 2.14
Find the result of the following operations:
a. 27 mod 5 b. 36 mod 12
c. −18 mod 14 d. −7 mod 10

Solution
a. Dividing 27 by 5 results in r = 2
b. Dividing 36 by 12 results in r = 0.
c. Dividing −18 by 14 results in r = −4. After adding the
modulus r = 10
d. Dividing −7 by 10 results in r = −7. After adding the modulus
to −7, r = 3.

2.42
2.2.2 Set of Residues

The result of the modulo operation with modulus n is always an


integer between 0 and n-1. In other words, the result of a mod n is
always a non-negative integer less than n.

The modulo operation creates a set, which in modular


arithmetic is referred to as the set of least residues
modulo n, or Zn.

2.43
2.2.3 Congruence

To show that two integers are congruent, we use the


congruence operator ( ≡ ). For example, we write:

2.44
2.2.3 Continued
Figure 2.11 Concept of congruence

2.45
2.2.3 Continued
Residue Classes
A residue class [a] or [a]n is the set of integers congruent
modulo n. In other words, it is the set of all integers such
that x = a (mod n). For e.g.: if n = 5, we have five sets [0],
[1], [2], [3] and [4]

The integers in the set [0] are all reduced to 0 when we apply the modulo 5 operation
on them.
In each set, there is one element called the least (non-negative) residue. In the set [0],
this element is 0; in the set [1], this element is 1. The set of all these residues is what we
have shown as Z5 = {0, 1, 2, 3, 4}. In other words, the set Zn is the set of all least
residue modulo n.
2.46
2.2.3 Continued
Figure 2.12 Comparison of Z and Zn using graphs

2.47
2.2.4 Operation in Zn

The three binary operations that we discussed for the set


Z can also be defined for the set Zn. The result may need
to be mapped to Zn using the mod operator.
Figure 2.13 Binary operations in Zn

2.48
2.2.4 Continued
Example 2.16
Perform the following operations (the inputs come from Zn):
a. Add 7 to 14 in Z15.
b. Subtract 11 from 7 in Z13.
c. Multiply 11 by 7 in Z20.

Solution

2.49
2.2.4 Continued
Example 2.17
Perform the following operations (the inputs come from either Z or
Zn):
a. Add 17 to 27 in Z14.
b. Subtract 43 from 12 in Z13.
c. Multiply 123 by −10 in Z19.

Solution

2.50
2.2.4 Continued
Properties

2.51
2.2.4 Continued
Example 2.18

The following shows the application of the above properties:

1. (1,723,345 + 2,124,945) mod 11 = (8 + 9) mod 11 = 6

2. (1,723,345 − 2,124,945) mod 11 = (8 − 9) mod 11 = 10

3. (1,723,345 × 2,124,945) mod 11 = (8 × 9) mod 11 = 6

2.52
2.2.4 Continued
Example 2.19

In arithmetic, we often need to find the remainder of powers of


10 when divided by an integer.

2.53
2.2.5 Inverses

When we are working in modular arithmetic, we often need to


find the inverse of a number relative to an operation. We are
normally looking for an additive inverse (relative to an addition
operation) or a multiplicative inverse (relative to a multiplication
operation).

2.54
2.2.5 Continue
Additive Inverse

In Zn, two numbers a and b are additive inverses of each other if

In Zn, the additive inverse of a can be calculated as b = n – a. For e.g. the additive
inverse of 4 in Z10 is 10 – 4 = 6

Note

In modular arithmetic, each integer has


an additive inverse. The sum of an
integer and its additive inverse is
congruent to 0 modulo n.

2.55
For example, the additive inverse of 4 in Z10
is 10 − 4 = 6.

2.56
2.2.5 Continued
Example 2.21

Find all additive inverse pairs in Z10.

Solution

The six pairs of additive inverses are (0, 0), (1, 9), (2, 8), (3, 7), (4,
6), and (5, 5).
In this list, 0 is the additive inverse of itself; so is 5. Note that the
additive inverses are reciprocal; if 4 is additive inverse of 6, then
6 is also additive inverse of 4.

2.57
2.2.5 Continue
Multiplicative Inverse
In Zn, two numbers a and b are the multiplicative inverse of each other if

For e.g. if modulus is 10, then the multiplicative inverse of 3 is 7. In other words,
we have (3*7) mod 10 = 1

Note

In modular arithmetic, an integer may or


may not have a multiplicative inverse.
When it does, the product of the integer
and its multiplicative inverse is
congruent to 1 modulo n.
2.58
2.2.5 Continue
Multiplicative Inverse
In Zn, two numbers a and b are the multiplicative inverse of each
other if

Note

a has a multiplicative inverse in Zn if and


only if gcd (n, a) = 1.
In this case, a and n are said to be
relatively prime.

2.59
2.2.5 Continued

Example 2.22
Find the multiplicative inverse of 8 in Z10.
Solution
There is no multiplicative inverse because gcd (10, 8) = 2 ≠ 1. In
other words, we cannot find any number between 0 and 9 such
that when multiplied by 8, the result is congruent to 1.
Example 2.23
Find all multiplicative inverses in Z10.
Solution
There are only three pairs: (1, 1), (3, 7) and (9, 9). The numbers 0, 2, 4, 5,
6, and 8 do not have a multiplicative inverse. We can see that (1*1) mod
10 = 1
(3*7) mod 10 = 1
(9*9)
2.60
mod 10n = 1
2.2.5 Continued
Example 2.24
Find all multiplicative inverse pairs in Z11.
Solution
We have seven pairs: (1, 1), (2, 6), (3, 4), (5, 9), (7, 8), (9, 9), and (10,
10). In moving from Z10 to Z11, the number of pair doubles. The reason
is that in Z11, gcd (11,a) is 1 (relatively prime) for all values of a except
0. It means all integers 1 to 10 have multiplicative inverses.

The integer a in Zn has a multiplicative inverse if and only if gcd (n,a) =-


1 (mod n)

2.61
2.2.5 Continued

Note

The extended Euclidean algorithm finds


the multiplicative inverses of b in Zn
when n and b are given and
gcd (n, b) = 1.
The multiplicative inverse of b is the
value of t after being mapped to Zn.

2.62
2.63
2.2.5 Continued
Example 2.25
Find the multiplicative inverse of 11 in Z26.
Solution

The gcd (26, 11) is 1; the inverse of 11 is -7 or 19.

2.64
2.2.5 Continued
Example 2.26
Find the multiplicative inverse of 23 in Z100.
Solution

The gcd (100, 23) is 1; the inverse of 23 is -13 or 87.

2.65
2.2.5 Continued
Example 2.27
Find the inverse of 12 in Z26.
Solution

The gcd (26, 12) is 2; the inverse does not exist.

2.66
2.2.6 Addition and Multiplication Tables
Figure 2.16 Addition and multiplication table for Z10

2.67
2.2.7 Different Sets
Figure 2.17 Some Zn and Zn* sets

Note

We need to use Zn when additive


inverses are needed; we need to use Zn*
when multiplicative inverses are needed.
2.68
2.2.8 Two More Sets

Cryptography often uses two more sets: Zp and Zp*. The


modulus in these two sets is a prime number.

2.69
2-3 MATRICES

In cryptography we need to handle matrices. Although


this topic belongs to a special branch of algebra called
linear algebra, the following brief review of matrices is
necessary preparation for the study of cryptography.

Topics discussed in this section:


2.3.1 Definitions
2.3.2 Operations and Relations
2.3.3 Determinants
2.3.4 Residue Matrices

2.70
2.3.1 Definition

Figure 2.18 A matrix of size l ´ m

2.71
2.3.1 Continued

Figure 2.19 Examples of matrices

2.72
2.3.2 Operations and Relations
Example 2.28

Figure 2.20 shows an example of addition and


subtraction.

Figure 2.20 Addition and subtraction of matrices

2.73
2.3.2 Continued
Example 2. 29

Figure 2.21 shows the product of a row matrix (1 × 3)


by a column matrix (3 × 1). The result is a matrix of size
1 × 1.

Figure 2.21 Multiplication of a row matrix by a column matrix

2.74
2.3.2 Continued
Example 2. 30

Figure 2.22 shows the product of a 2 × 3 matrix by a


3 × 4 matrix. The result is a 2 × 4 matrix.

Figure 2.22 Multiplication of a 2 × 3 matrix by a 3 × 4 matrix

2.75
2.3.2 Continued
Example 2. 31

Figure 2.23 shows an example of scalar multiplication.

Figure 2.23 Scalar multiplication

2.76
2.3.3 Determinant

The determinant of a square matrix A of size m × m


denoted as det (A) is a scalar calculated recursively as
shown below:

Note

The determinant is defined only for a


square matrix.
2.77
2.3.3 Continued
Example 2. 32

Figure 2.24 shows how we can calculate the determinant


of a 2 × 2 matrix based on the determinant of a 1 × 1
matrix.

Figure 2.24 Calculating the determinant of a 2 ´ 2 matrix

2.78
2.3.3 Continued
Example 2. 33

Figure 2.25 shows the calculation of the determinant of


a 3 × 3 matrix.

Figure 2.25 Calculating the determinant of a 3 ´ 3 matrix

2.79
Additive Inverse: The additive inverse of the matrix A is
another matrix B such that A + B = 0.

In other words, we have bij = -aij for all values of I and j.


Normally, the additive inverse of A is defined by –A.

2.80
2.3.4 Inverses

Note
Multiplicative inverses are only defined
for square matrices.
The multiplicative inverse is defined only for square matrices. The
multiplicative inverse of a square matrix A is a square matrix A is a
square matrix B such that A * B = B * A = I. Normally the
multiplicative inverse A is defined by A^-1.

Matrices with real elements have inverse only if det(A) not equal to 0.

2.81
2.3.5 Residue Matrices

Cryptography uses residue matrices: matrices where all


elements are in Zn. A residue matrix has a multiplicative
inverse if gcd (det(A), n) = 1.

Example 2. 34

Figure 2.26 A residue matrix and its multiplicative inverse

2.82
2-4 LINEAR CONGRUENCE

Cryptography often involves solving an equation or a set of


equations of one or more variables with coefficient in Zn. This
section shows how to solve equations when the power of each
variable is 1 (linear equation).
Two matrices are congruent modulo n, A=-B(mod n). If they
have same number of rows and columns.

Topics discussed in this section:


2.4.1 Single-Variable Linear Equations
2.4.2 Set of Linear Equations

2.83
2.4.1 Single-Variable Linear Equations

Equations of the form ax ≡ b (mod n ) might have no solution or


a limited number of solutions.

1. Reduce the equation by dividing both sides of the equation by d. (including


the modulus)
2. Multiply both sides by multiplicative inverse of a to find the particular
solution x0
3. The general solution are x = x0 + k(n/d)

2.84
2.4.1 Continued

Example 2.35
Solve the equation 10 x ≡ 2(mod 15).
Solution
First we find the gcd (10 and 15) = 5. Since 5 does not divide 2,
we have no solution.
Example 2.36
Solve the equation 14 x ≡ 12 (mod 18). Note gcd(14, 18) = 2.
Since 2 divides 12, we have exactly two solutions. A*b mod n = 1
Solution

2.85
2.4.1 Continued
Example 2.37

Solve the equation 3x + 4 ≡ 6 (mod 13).

Solution
First we change the equation to the form ax ≡ b (mod n). We add
−4 (the additive inverse of 4) to both sides, which give
3x ≡ 2 (mod 13). Because gcd (3, 13) = 1, the equation has only
one solution, which is x0 = (2 × 3−1) mod 13 = 18 mod 13 = 5.
We can see that the answer satisfies the original equation:
3 × 5 + 4 ≡ 6 (mod 13).

2.86
2.4.2 Single-Variable Linear Equations

We can also solve a set of linear equations with the


same modulus if the matrix formed from the coefficients
of the variables is invertible.
Figure 2.27 Set of linear equations

2.87
2.4.2 Continued

Example 2.38
Solve the set of following three equations:

Solution
The result is x ≡ 15 (mod 16), y ≡ 4 (mod 16), and z ≡ 14 (mod
16). We can check the answer by inserting these values into the
equations.

2.88

You might also like