Applications of Matrices To Cryptography
Applications of Matrices To Cryptography
net/publication/350640240
CITATIONS READS
0 1,790
1 author:
Erick Wanjohi
University of Eastern Africa, Baraton
2 PUBLICATIONS 0 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Erick Wanjohi on 05 April 2021.
April, 2021
Declaration
Declaration by candidate
I Erick Wanjohi, I declare that this research paper is my original work and it has not been submitted for
with the approval as a class supervisor for the course MATH 499: Mathematics Project.
i
Acknowledgement
My deepest gratitude and thanks to Dr. Zachary Kayiita, for guiding and correcting my project with
attention and care. He has taken pain to go through this project and made necessary corrections as and
when needed.
I also thank my friend Mr. Samuel Mwangi, who allowed me to use his laptop when mine failed in the
I also extend my heartfelt thanks to the family of Mr. Grishon Maina, for their continued prayers and
support, without whom this project would have been a distant reality.
ii
Dedication
This work is dedicated to my family members, without their caring, and support it would not have been
possible, and to my parents, who passed on a love of reading and respect for education. They, who taught
me that the best kind of knowledge to have is that which is learned for its own sake, and that even the
iii
Table of Contents
Declaration ..................................................................................................................................................... i
Acknowledgement ........................................................................................................................................ ii
Abstract ......................................................................................................................................................... v
CHAPTER ONE ........................................................................................................................................... 1
1.1 Background information ..................................................................................................................... 1
1.2 Statement of problem .......................................................................................................................... 3
1.3 Objectives ........................................................................................................................................... 4
1.3.1 General objective .................................................................................................................. 4
1.3.2 Specific objectives ....................................................................................................................... 4
1.4 Research methodology ........................................................................................................................ 4
1.5 Justification ......................................................................................................................................... 5
1.6 Significance of study........................................................................................................................... 5
1.7 Definition of terms .............................................................................................................................. 5
CHAPTER TWO .......................................................................................................................................... 6
2.0 Literature review ..................................................................................................................................... 6
2.1 Introduction ......................................................................................................................................... 6
CHAPTER THREE .................................................................................................................................... 11
3.1 Findings and illustration ................................................................................................................... 11
CHAPTER FOUR ....................................................................................................................................... 19
Conclusion .............................................................................................................................................. 19
Recommendation .................................................................................................................................... 19
Reference List ............................................................................................................................................. 20
iv
Abstract
Cryptography is a discipline of encoding and decoding messages. Cryptography is used frequently in
people’s daily lives to keep sensitive information, such as credit card information. This research study
inspects matrices and its real-life application in cryptography. The focus of this project is to investigate
how to generate keys in order to encrypt words using Hill ciphers. Diffie-Helman mechanism will also be
looked in this project. The effectiveness of the encryptions studied and more secure means of encryption
will be presented by use of matrix.
v
CHAPTER ONE
1.1 Background information
Communication networks like wireless, wired and optical are able to carry huge amounts of data and thus
privacy of information and security of the network are of the utmost concern because a good part of the
information may be very sensitive or confidential [1]. Confidentiality of information has been accorded
prime importance with the explosive growth of the internet, which has touched most people’s lives.
Cryptography has been a confidential way of exchanging information. This chapter will give an insight of
linear algebra which is considered as a mother of matrices, it will also outline objectives of this research,
statement of the problem, scope of study, significance of doing this research and it will give a definition
of few terms. In order to clarify the history of matrices and its applications the influence of matrices in
mathematical world is spread wide because it provides an important base to many of principles and
practices. It is very important to define matrix. Matrix it is a Latin word for womb. Matrix can be defined
as an orderly arrangement of some number or symbols in certain rows and columns enclosed by some
brackets, subscribe by magnitude of its order and denominated by some capital letters [2].
In origin of mathematical matrices, it lies with the study of simultaneous linear equations. About
4000years ago the Babylonians knew how to solve a system of equations in two unknowns (a
2× 2 𝑠𝑦𝑠𝑡𝑒𝑚) in their famous nine chapters of the mathematical art (200bc) the chine’s solved 3×3
system by working solely with their numerical coefficients. This gave the first known example of the use
The modern study of system of linear equation can be said to have originated with Leibniz who in 1693
invented the notion of a determinant for this purpose but his investigation remained unknown at time. In
18th century the study of linear equation was usually subsumed under that of determinants. In connection
the invention the method of least squares (published in a paper in 1811 dealing with the determination of
the orbit of an asteroid), Gauss introduced a systematic procedure now could gauss elimination method.
This is also a use of matrix-like arrangements for solving simultaneous equation [15].
1
This project seeks to give an overview of the history of matrices and its applications touching on the
various topics used in concordance with it. The emergence of the subject came from determinants studied
by the founder of calculus, Leibnitz in the late 17thcentury langrage multipliers. (Darwking) more than 50
years later, crammer presented this idea of solving n×n system of linear equations based on determinants
As stated earlier, Gauss –elimination method was based on solving linear equations themselves initially,
but did not have as much as much to do with matrices .in order for matrix algebra to develop a proper
notation of describing the process was necessary. Importantly to this process was the definition of matrix
multiplication. The introduction of matrix notation and invention of word matrix were motivated by
attempts to develop the right algebraic language for studying determinants. Sylvester introduced the term
matrix the Latin word for womb as a name for array numbers. He used word womb, because see linear
algebra has become more relevant since the emergence of calculus even though it’s fundamental equation
Euler brought to ignite the idea that a system of equation does not necessarily have to have a solution. He
recognized the need of conditions to be placed upon known variables in order to get a solution. The initial
work up until this period mainly dealt with a concept of unique solutions and square matrices where the
number of equations matched the number of unknowns. In 19th century Gauss introduced a procedure to
be used for solving a system of linear equations. His work mainly dealt with linear equations of different
numbers and variables. This method was known as Gaussian elimination method which involves concept
of combining, swapping or multiplying with each other in order to eliminate variables from certain
equation. Then used backs substitution to find the remaining unknown variables. Tucker (1993) reviewed
2
Arthur Cayley (1885) came up with matrix multiplication or matrix algebra. He defined matrix
multiplication as the matrix of coefficients for the composite transformation T2T1I in the product of the
matrix T2 times the matrix of T1. Cayley’s work of matrix multiplication gave birth to Cayley Hamilton
theorem which simply states that square matrices satisfy matrices at the end of the 19thcentury were
heavily connected with physics and for mathematicians more attention was given to vectors.
With advancement of Cayley, Gauss, Leibnitz, Euler, and other determinants and linear algebra moved
forward more quickly and more effective. With regardless of technology Gaussian elimination still proves
the best way known to solve a system of linear equations. This project most of the linear equations will be
solved using Gaussian elimination method. Matrices have influenced mathematical world because it
provides an important base to many of the principles and practices. Some of the applications of matrices
include to find least-square best fit lines to predict future outcomes or trends, and to encode and decode
messages what we call cryptography. Matrices are also broadly applied in solving questions of energy in
quantum mechanics. With all these practical applications matrices have spread and advanced. For sure
technology continues to push the use further but the history of matrices and its applications continue to
provide the foundation. Even though every few years companies update their text books the fundamentals
association to another through electronic technology, there is requirement for cryptography as an answer
to this issue. Due to a big problem of plain text attack this research will try to solve this problem by
3
1.3 Objectives
Sources of data for this research methodology will be from books, articles, journals and oral lecture
history. This research will mainly use MATLAB computer software in solving matrices.
MATLAB stands for matrix laboratory which can be defined as an interactive computing system designed
Out of the literature discussed above the main problem facing application of matrices in cryptography is
plain text attack, this research paper will try to solve this problem by employing the use of the Diffie-
Hellman mechanism which is used in generating a secret key based on modular exponentiation. Diffie-
Hellman mechanism is a specific method of securely exchanging cryptographic keys over public channel.
This research is going to examine a method of encryption that uses matrix multiplication and matrix
III. Multiply this matrix with a secret key square matrix which in our case will be generated by use of
4
V. message you multiply decoded message with the inverse of secret key
In summary this research will mainly deal with multiplication of matrices and generation of a secret key
1.5 Justification
With the increasingly rise of cipher text cracking, it is important to employ the use of the Diffie-Hellman
to other researchers because of the research findings of this study will benefit researchers with literature
review to expand their research into application of matrices. It helps address and provide background
information for scholars who would want to carry further research in this area.
columns enclosed by some brackets, subscribe by the magnitude of its order and denominated by some
capital letter.
Cryptography: cryptography is associated with the process of converting ordinary plain text into
unintelligible text and vice versa. It is a method of storing and transmitting data in a particular form so
that only those for whom it is intended can read and process it.
Secret key: it is a piece of information that is used to encrypt and decrypt messages in a symmetric.
Encoding: This is the process of converting data from one form to another.
5
CHAPTER TWO
2.1 Introduction
This chapter gives an insight into the literature by other scholars and researchers on the aspect of
applications of matrices. It reviews literature that is related to the specific and general objectives of the
research. It specifically covers the past studies /main review where it discusses literature related to the
specific objectives of study. It also presents literature on critical review of major issues, summary and
gaps to filled.
According to [4] use of matrix multiplication Hill Cipher acts on groups of letters, where plaintext is
divided into groups of letters of a fixed size, and each group is transformed into different group of letters.
Hiller cipher applies matrices to cryptography. Ciphers are methods for transforming a secret message
called plaintext into a particular form so that only those for whom it is intended and know the key can
read and process it. A common way to send coded messages is to assign numerical values from 1-26 to
the alphabet and send a message to a string of integers. The problem with this is that these codes are
easily broken using an analysis of frequency of numbers that appears in the coded messages.
𝐶 𝑤ℎ𝑒𝑟𝑒 𝐵 𝑖𝑠 𝑡ℎ𝑒 𝑚𝑒𝑠𝑠𝑎𝑔𝑒 , 𝐴 𝑖𝑠 𝑡ℎ𝑒 𝑒𝑛𝑐𝑜𝑑𝑖𝑛𝑔 𝑚𝑎𝑡𝑟𝑖𝑥 𝑎𝑛𝑑 𝐶 𝑖𝑠 𝑡ℎ𝑒 𝑒𝑛𝑐𝑟𝑦𝑝𝑡𝑒𝑑 𝑚𝑎𝑡𝑟𝑖𝑥
On receiver side for the user to get the original message the following operation is used
𝐵 = 𝐴−1 𝐶
Map reduce and MPI are parallel and distributed computing systems with high-performance that spread
out a single application over many multi-core and multi-processor computers to rapidly complete the task.
U First method: sequential is accessed code by a single thread i.e., single thread can only do code in a
6
Second method is a library of routines that can be used to create parallel programs in C, C++ and fortrn77
using commonly available operating system services to create parallel processes and exchange
information among these processes. MPI is a standardized means of exchanging messages among
multiple computers running in a parallel program across a distributed memory to improve scalability,
performance, multi-core and cluster support, and interoperation with other applications.
According to [5] elliptic curves are fundamental objects in a large part of mathematics and seems to be
interesting because their study involves several fields of mathematics. It states that in 1985 Neal Koblitz
and victor miller independently proposed using groups of points on an elliptic curve system have over
systems based on multiplicative group of finite fields is the absence of the sub-exponential time algorithm
that could find discrete logarithms in these groups. In this research it stated that properties of invertible
matrices combined with elliptic curve so as to provide a novel mapping method for encrypting / process.
In this algorithm the original message is transformed by using mapping method and coded with non-
singular matrix. Then the result of decryption process is to put in matrix form to be decoded by the
A review on cryptography with elliptic curve was concerned with a restricted form of elliptic curve that is
defined over a finite field noted Fp. One particular interest for cryptography is what is referred to as the
Ep (α, β) denotes the elliptic group mod p whose elements (x, y) are pairs of non-negative integers less
than p satisfying:
𝑦 2 = (𝑥 3 + 𝛼𝑥 + 𝛽)𝑚𝑜𝑑 𝑝 … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … . . (2)
7
This paper used Elgamal cryptosystem approach in encryption/ decryption using elliptic curves. It further
One of the examples looked on this research was communication between Alice and Bob. Suppose here
that we have some elliptic curve E defined over a finite field Fp and that E and a point p∈ 𝐸 are publicly
known as the embedding system m𝑚 → 𝑝𝑚 which imbed plain text on elliptic curve E then when Alice
I. Bob chooses a random integer a and publishes the point aP (remains secret)
II. Alice chooses her own random integer I and sends the pair of points , (𝑃𝑖 + 𝐼(𝑎𝑃)) to Bob
(remains secret)
III. To decrypt message Bob calculate a(Ip) from the first part of the pair, then subtracts it from the
second part to obtain,𝑃𝑖 𝐼(𝑎𝑝) − 𝑎(𝐼𝑝) = 𝑝𝑖 + 𝐼𝑎𝑝 = 𝑝𝑖 and then reverse the embedding to get
This method both sender and receiver of message requires to know the following:
8
Mapping methodology is as follows:
We consider m the original message of length n. if n is not divided by 3, then the points have been
Step II: create the matrix of 3×r with entry points in step 1
𝑝1 𝑝2 𝑝3 … … 𝑝𝑟
𝑚 = [𝑝𝑟+1 𝑝𝑟+2 𝑝𝑟+3 … … 𝑝𝑠 ]
𝑝𝑠+1 𝑝𝑠+2 𝑝𝑠+3 … … . 𝑝𝑛
Step III: choosing a nonsingular matrix of 3×3 such that |𝐴| = ±1 then using addition and doubling of
Step IV: the result set of point is 𝑠 = [𝑄1 (𝑥1 , 𝑦1 ), 𝑄2 (𝑥2 , 𝑦2 ) … … … … 𝑄𝑛 (𝑥𝑛 , 𝑦𝑛 )]
This message can be retrieved from the encoded data using the elliptic curve decryption techniques and
According to [3] many cryptosystems were designed to prevent data from unauthorized access, and some
are relatively not secure enough. This paper states Hill cipher algorithm as the most efficient
cryptosystems. This study provided a solution for the problem of non-invertible matrix by modifying the
way of dealing with key matrix, and make all matrices moreover, it solved the known of pair and cipher
text problem by generating new key matrix for each encrypted block of plaintext, using SHA-512. This
paper also gives the techniques to overcome all Hill Cipher problems.
9
First technique is to solve the problem of non-invertible matrices which enables us to use the second
method. This study classifies encryption system into two main categories i.e., Symmetric and
asymmetric. Symmetric encryption /secret key/ single key, uses the same key that sender uses to encrypt
the data and to decrypt it by receiver on the other side. In a symmetric encryption a safe way must be
used to move a secret key. Asymmetric encryption method is slow and complicated in nature. This paper
defined Hiller cipher as application of modular linear algebra to cryptology. Hill cipher was invented by
Lester S. Hill in 1929. His idea was matrices multiplications in which every character or group of
characters in the plaintext is substituted by a character or a group of characters in the cipher text, and
𝑐 = 𝑘 × 𝑥𝑚𝑜𝑑 𝑝
Where c=cipher text x=plain text k= key matrix p=is the modular value
𝑥 = 𝑘 × 𝑐 𝑚𝑜𝑑 𝑝
II. Plaintext attack due to that Hill cipher linear nature; the cryptosystem can be broken through the
10
CHAPTER THREE
procedures;
V. To decode the encoded message multiply decoded message by inverse of secret key.
Every alphabetic letter is assigned a number. In this section we will use the correspondence shown below,
where letters A to Z corresponds to numbers 1 to 20, a space is represented by number 27, and
punctuation is ignored.
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z SPACE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Since the generated matrix will be multiplied by the secret key it must have the following
property. Let A and B be two matrices denoted by AB for matrix multiplication the number of
columns in the first matrix must be equal to the rows in the second matrix i.e., if A is m×n and B
11
According to [13] a secret key it is a single key needed to encrypt and decrypt messages where it
is shared secretly between two communicating parties. A biggest problem is that this secret key
must be communicated through external mechanism separate from the communication channel
over which the encrypted text follows. With this secret message it is easy to decrypt the encoded
message. Due to need of secrecy this research employs the use of Diffie-Helman key exchange
which establishes a shared secret. The Diffie –Helman key algorithm solves the following; Erick
and Mary want to share a secret key for use in a symmetric cipher, but their only means of
I. Step I Erick and Mary to agree on a prime number p and a nonzero integer g which is
called generator. This values p and g are made public and can be shared via mails.
II. Step II for Erick to pick a secret integer ‘a’ that he does not reveal to anyone, while at
the same time Mary picks an integer ‘b’ that she keeps secret
III. Step III. They later exchange A and B i.e., Erick sends A to Mary and Mary sends B to
Erick, since these numbers are sent through mails they cannot be considered as secret
IV. Step IV. Finally, Erick and Mary again use their secret integers to compute
The resulting figure k is common to Erick and Mary and it is considered to be secret
12
Procedure IV. Since the generated key is secret it can be used to encode the message been sent via public
device to the recipient encoding of the message is done by multiplying the matrix message by the secret
key.
Procedure V. Since the recipient has the secret key, he/she can use the inverse of secret key to decode the
encrypted message. Based on the knowledge in algebra we know that if given two matrix A and B matrix
𝐴. 𝐵 = 𝐶
𝐴 = 𝐶. 𝐵−1
Illustrations
First illustration
Erick and Mary wanted to exchange ATM number through mail but they are worried that there could be a
third-party hacker by the name Denis. So, they choose to use matrices in exchanging ATM number.
They had to agree on the secret key to use, the problem was that they were far to each other so the only
means they can use to share the secret key is via public transport. Due to sensitivity of the information, it
was required that this secret key should be shared securely as possible.
13
They both know p=23 and g generator =11
Erick Mary
14
a=7 A= 117 mod 23= 7 b= 8 B= 118 mod 23= 8
15
Hence the generated secret key via secure method of sharing key is
8 6 1 9
12 13 12 9
𝐴=[ ]
6 16 3 16
2 12 21 13
5 9 3 4
3 4 6 3
𝑀=[ ]
1 0 9 8
4 2 0 4
8 6 1 9 5 9 3 4 95 114 69 94
12 13 12 9 3 4 6 3 147 178 222 219
𝑋= [ ]×[ ]=[ ]
6 16 3 16 1 0 9 8 145 150 141 160
2 12 21 13 4 2 0 4 119 92 267 264
The encoded message is sent to Mary through public transport. So as Mary to get the intended message
she is required to decode the message sent by Erick by multiplying the encoded message with an inverse
of A.
16
3 1 1 1
− −
34 17 17 34
138 61 75 39 95 114 69 94 5 9 3 4
− −
667 697 697 697 147 178 222 219 3 4 6 3
𝑀= ×[ ]=[ ]
23 106 361 355 145 150 141 160 1 0 9 8
− 119 92 267 264 4 2 0 4
7667 7667 7667 7667
1260 860 109 447
[ 7667 − 7667 − 7667 7667 ]
After multiplying the encrypted message with an inverse, Mary was able to get the exact ATM number in
secured manner. Denis the third-party hacker cannot hack the information sent to Mary due that he
Second illustration
In war between Kenyan military and Alshabab. In obvious way Kenyan military group themselves into
troops. One troop can wish to send a message to another troop in a secured manner. Let say the intended
1 20 20 13 11 27 9 19 27 20 15 14 9 7 8 20
3 10 20
𝐴 = [20 9 17]
9 4 17
17 6 2
−
327 109 327
187 43 349
𝐴−1 = −
1635 545 1635
1 26 173
[ 1635 −
545 1635 ]
17
3 10 20 1 1 27 27 14 8 603 253 351 581 272 224
𝑋 = [20 9 17] × [20 3 9 20 9 20] = [540 234 774 975 480 340]
9 4 17 20 11 9 15 7 0 429 208 432 578 281 152
17 6 2
−
327 109 327
187 43 349 603 253 351 581 272 224 1 1 27 27 14 8
− × [540 234 774 975 480 340] = [20 3 9 20 9 20]
1635 545 1635 429 208 432 578 281 152 20 11 9 15 7 0
1 26 173
[ 1635 −
545 1635 ]
The resulting matrix is then converted into alphanumeric form so that the second troop can get the
intended message.
𝑨 𝑨 𝑠𝑝𝑎𝑐𝑒 𝑠𝑝𝑎𝑐𝑒 𝑵 𝑯
[𝑻 𝑪 𝑰 𝑻 𝑰 𝑻 ]
𝑻 𝑲 𝑺 𝑶 𝑮 𝑠𝑝𝑎𝑐𝑒
ATTACK IS TONIGHT
18
CHAPTER FOUR
Conclusion
With the increase of insecurity in passing sensitive data from one person to the other, application of
matrices in cryptography can be used in passing data in a secured manner. This study employed use of
Diffie-Helman mechanism which improvised ways in which secret key can be transported using public
transport.
Recommendation
Future research studies should use advanced cryptography techniques like Data Encryption Standard
(DES), blow fish, two fish and Rivest-Shamir-Ad leman (RSA). This will help in minimizing cybercrime
19
Reference List
[1]. Andrew S. Tannebaum Computer Networks second edition Prentice Hall, (2003)
[2]. Householder, Alston the Theory of matrices in numerical analysis New York, (1975)
[3]. Farajallah, M., & Hamamreh, R. Self-generating multi keys cryptosystem model for noninvertible
matrices based on hill cipher Algorithm. Proceedings of the 2009 International Conference on Security
[4]. Chattaroy, S. K., Majhi, J., & Rath, G. S. Encryption by Hill cipher and by a novel method using
Chinese remainder theorem in Galois field. International Journal of Signal and Imaging Systems
[5]. Amounas, F., & El Kinani, E. H Fast mapping method based on matrix approach for elliptic curve
cryptography. International Journal of Information & Network Security (IJINS), 1(2). (2012).
[6]. Meyer, C. D Matrix analysis and applied linear algebra (Vol. 71). Siam, (2000).
[7]. Margenau, Henry; Murphy, George Moseley. The Mathematics of Physics and Chemistry. Princeton: Van
Nostrand (1996)
[9]. Gilat Amos MATLAB: An introduction with applications second edition John Wiley and Sons
[10]. Atkinson, Kendal A. An introduction to numerical analysis second edition New York, (1998)
[13] Mathew Copeland, Joergan Grahn (1999) the GNU privacy handbook
20