Application of Linear Algebra in Cryptography - Judithlopez - S20216454W

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

BEIJING UNIVERSITY OF TECHNOLOGY

FOUNDATION OF
MODERN MATHEMATICS
Final Essay

APPLICATIONS OF
LINEAR ALGEBRA
IN CRYPTOGRAPHY

Judith López González


S20216454W

Fall – Winter
2021 -2022
ABSTRACT

This paper in intended to provide some examples on the application of linear algebra in
cryptography. An introductory brief explanation on the concept of cryptography is presented,
followed by the explanation of some cryptography systems and examples with some algebraic
exercises, also a description on the current status of cryptography methods is offered.
Conclusion refers to the potential that algebra possess, allowing for more complex and secure
cryptography systems to be developed.

INTRODUCTION

Throughout this course, we have had the opportunity to review knowledge and concepts about
algebra. Within the area of mathematics, algebra serves as a method for the description of
operations, formulas, and equations in a concise and efficient way, thus becoming an ideal tool
for the definition and automation of processes, as is the case in its application. in cryptography.

The term cryptography from the Greek kryptos meaning "hidden" or "secret", is a concept that
is not unknown due to its popular use nowadays due to the practices of protecting and ensuring
from the interference of third parties, the data constantly shared to through the various media.

Cryptography nowadays has developed into a practice and study to secure communications in
many different fields. The main purpose of cryptography is that only the sender and the
intended recipient of the message can view and understand its content.

Cryptography has used algebra to define from basic operations to complex processes in the
encryption of information. Through this paper, we will proceed to break down what this
relationship between algebra and cryptography is like.
Cryptography can be described as the practice of enciphering and deciphering messages into
codes that can only be intelligible for the one who sends the message and the receiver. Due to
the necessity of protecting information from the attack of outsiders, principles of cryptography
are today applied to the encryption of multiple network communications. In particular, the
secure exchange of computer data is of great importance to banking, government, and
commercial communications.

Cryptography played a major role in the course of World War II, and some of the first working
computers were dedicated to cryptanalytic tasks.

Cryptography and computer science are intimately associated, since in the present-day
computing devices are in charge of performing complex calculations in order to encipher and
decipher messages, the capability of the computing resources is in direct relationship with the
amount of complexity in the method to be applied.

The transformation of data in cryptography provide solutions to two major problems of data
security: the privacy problem, preventing an opponent from extracting information from a
communication channel, and the authentication problem, preventing an opponent from
injecting false data into the channel or altering messages so that their meaning is changed.

A very simple expression for this relationship between original message and encrypted
message, is that where we have a plaintext or unenciphered message P, which is to be
communicated to a legitimate receiver susceptible to the attack of a third party. To prevent the
outsider from learning the contents of P, the transmitter enciphers or encrypts P with an
invertible key K to produce the cryptogram or ciphertext C = K(P). When the legitimate
receiver obtains C he deciphers or decrypts it with the inverse transformation K-1, P = K-1 (C).

If cryptanalyst cannot deduce P from C, or C from P without prior knowledge of the key, the
cryptographic system is said to be secure.

The transformation key K is chosen from a family of transformations known as a cryptographic


system, general system, or merely system. The general system might be a set of instructions, a
piece of hardware, or a computer program which is capable of encrypting the plaintext and
decrypting the ciphertext.
EXAMPLES OF SYSTEMS

Beginning with some basic transformations and then going through some exercises applying
linear algebra, we are going to examine a number of representative examples of cryptography
systems:

1. Substitution

Have been used throughout history, one of the most famous is the caesarian cypher, named
after Julius Caesra (100BC - 44BC). In a Caesar cypher, the cyphertext is always shifted by 3
from the plaintext, A = D, B = E, C = F, etc. In this method each letter of the alphabet from the
plaintext is substituted with a different letter to obtain the cypher text, the key is one of the
possible permutations of the alphabet.

Example:

ABCDEFGHIJKLMNOPQRSTUVWXYZ - BWEKQFMVYALUCONPHSIDXTRGZJ

Plaintext:
TODAY IS A GREAT DAY
Transformed:
DNKBZ YI B MSQBD KBZ

Substitution cryptograms is insecure


and easy to break, can be solved by
making frequency tables of letters and
searching for common words (see
Figure 01). These allow the
identification of the plaintext letters
corresponding to the letters of the
cryptogram.

Figure 01.
2. Transposition

In transposition, the position of the plaintext letters in the message rather than the letters of the
alphabet are permuted. An early version of a transposition cipher was a Scytale, in which paper
was wrapped around a stick and the message was written. Once unwrapped, the message would
be unreadable until the message was wrapped around a same-sized stick again (see Figure 02).

Figure 02.

One modern transposition cipher is done by writing the message in rows, then forming the
encrypted message from the text in the columns.

Example:
Encrypt the message “WE ARE GOING TO THE BEACH TOMORROW AFTER TEN” in a
6x6 matrix:

Figure 03.

The encoded message would be:

WOTCRT EIHHRE ANETOR RGBOWT ETEMAE GOAOFN


Substitution of rows and columns (element row operation) can be applied in order to add
complexity. Since the transposition cipher does not change the frequency of individual letters,
it is still susceptible to frequency analysis such as in Figure 01. can be applied.

Substitution and transposition, although very simple and easy to decipher techniques have been
the start point in the search for more secure and sophisticated methods that evade frequency
and the employment of inverse keys in deciphering encrypted messages.

3. Polyalphabetic Cipher

It was introduced to improve monoalphabetic technique in the substitution method. It was the
cryptographers answer to frequency analysis. In this type of method, the alphabets for a
particular letter in the original world will not repeat in the resulting encrypted message.

3.1.Vigenère Cipher

Vigenère cipher is a method of encrypting alphabetic text employing a form of polyalphabetic


substitution. Its algebraic description can be written as:

i, position of the character


Ci, encrypted message
E, refers to the Vigenère encryption
Mi, original message or plaintext
Ki, encryption key
Mod 26, is used to keep the resulting numbers in the range of 1-26 letters of the alphabet
(Details on how to calculate the modulo is not provided on this paper, but the reader is
encourage to further investigate if needed).

To decrypt (D) the message the inverse operation is performed:


In general, if Σ is the alphabet of length ℓ and m is the length of key, Vigenère encryption and
decryption can be written:

Example:

Using the map,

The word MAMA = {(13), (1), (13), (1)} could be arranged in a 2x2 matrix:

13 1
13 1

A random Key BLXZ = {(2), (12), (24), (26)} with the same length is implemented, gives us:

2 12
24 26

Applying the formula, we have:

+ , mod 26 =

The encrypted message would read as OMKA = {(15), (13), (11), (1)}. As we can see, the
frequency of letters is lost in the result. If needed, transposition can be added to obtain more
complexity.
The decryption operation would read as:

- , mod 26 =

The primary weakness of the Vigenère cipher is that periodic keys tend to be use by repeating
a certain combination of letters until the same length of the message is obtained. If a
cryptanalyst correctly guesses the key's length n, the cipher text can be broken.

The Kasiski examination, also called the Kasiski test, takes advantage of the fact that repeated
words are, by chance, sometimes encrypted using the same key letters, leading to repeated
groups in the ciphertext.

If a plaintext is enciphered with a periodic polyalphabetic cipher, and the resulting cryptogram
is superenciphered with a second periodic polyalphabetic cipher with a different length,
cryptanalysis of such multiple systems is more difficult but can still be decipher.

In an effort to remove the weakness of periodic polyalphabetic ciphers, cryptographers turned


to running key ciphers which are aperiodic polyalphabetic avoiding repetition by employing a
sequency with all different characters. Yet it is susceptible to be attacked by trying a number
of probable words, one will usually produce success and by further testing the key can be
deciphered.
3.2.The Hill Cipher

Another form of polyalphabetic cipher is the Hill cipher, which formula is written as:

Ci = Ai Pi mod 26
i, position of the character
Ci , encrypted message
Ai, encryption key
Pi, original message or plaintext
Mod 26, is used to keep the resulting numbers in the range of 1-26 letters of the alphabet

For decryption we have:


Pi = Ai-1 Ci mod 26

In this case some additional steps are to be considered since the inverse of A applying modulo
26 is required, which is different to the conventional inverse of A = A-1. A modular
multiplicative inverse is needed, this is an integer x such that the product ax is congruent to 1
with respect to the modulus m. This can be written as: ax = 1 mod (m).

An exercise for better understanding:

Using the previous map:

The word MATH = {(13),(1),(20),(8)}. We convert it into pairs of vectors:

P = (13 1)T
(20 8)T

The key matrix to use will be:

A= 1 1
0 3
Then we have:

Ci = 1 1 13 mod 26 = 14
0 3 1 3

Ci = 1 1 20 mod 26 = 28 = 2
0 3 8 24 24

The encrypted message reads NCBX = {(14), (3), (2), (24)}

Now to decrypt the message we need to calculate both matrix inverse and its modular
multiplicative inverse. First step, we calculate det A:

det A = 1 1 = 3,
0 3

The modular multiplicative inverse will be the number that multiplied by the determinant = 1
mod 26. The number that meets this condition is 9, as we can see:

3 x 9 = 27 = 1 mod 26, then det A-1 = 3-1 = 9 mod 26

The inverse of A modulo 26 is:

Now we can decrypt the message:

Pi = 1 -9 14 mod 26 = -13
0 9 3 1

1 -9 2 mod 26 -214 = 20
Pi = =
0 9 24 216 8

The obtained values correspond to our original message, MATH = {(13),(1),(20),(8)}.


In an effort to tackle weaknesses in previous methods, newer cryptography methods are
constantly developed and put into practice.

In opposition to symmetric key algorithms, where the same key is used to both encrypt and
decrypt the message and is also shared by both the sender and the recipient, to use a secure
channel to share the key and the increase in amount of generated keys when users increase,
becomes a challenge.

Since the appearance of the concept of public-key cryptography in 1975, where a pair of keys
is created, one that can be shared and another only known by the owner, newer techniques are
developed with this approach. This can be obtained through mathematical “one-way”
functions, also known as “trap-door”, these are functions that are easy to compute in one way
but difficult to invert in terms of the needed computational capabilities.

Details on the implementation of these methods are not provided in this paper, being these
calculations outside of the scope of linear algebra and the excessively technical complexities
involved, yet it is mentioned as to present the status of current cryptography techniques.

Examples of these techniques are:

4. Rivest Shamir Adleman or RSA

Was created 1n 1977 as one of the first asymmetric key encryption algorithm. Thought some
consider it outdated, it continues to be broadly used in the present day. It relies on the difficulty
to perform prime numbers factorization, also requires large key lengths and therefore more
computational resources. It is described:

C = Me mod n
M = Cd mod n

M, original message or plaintext


C, encrypted message
e, encryption public key
n, encryption public key, product of two different and large numbers p and q
d, decryption key, after further analysis we have that d = k Φ(n)+1/e (details on the obtention
of this formula is outside the scope of this study, yet the reader is encouraged to do further
investigations, phi (Φ) function and Euler’s Theorem are applied)

Example:

M = 89
n = p x q = 53 x 59 = 3127
e=3
d = 2011

C = 893 mod 3127 = 1394


M= 13942011mod 3127 = 89

The decryption key can only be applied by a third party or an outsider, only if the value of n
is known, this could be achieved with factorization, yet in terms of human or computational
capabilities would take a large amount of time.

5. Elliptic-Curve Cryptography or ECC

It is an approach to public-key cryptography based on the algebraic structure of elliptic curves.


Was introduced around 1980’s and represents a perfect example of modern cryptography. ECC
allows smaller keys than RSA, a 256-bit key on ECC would need a 3072-bit key on RSA
providing the same security. The only challenge with ECC is the more sophisticated
mathematics behind it. The elliptic curve can be described with the equation:

y2 = x3+ ax + b
CONCLUSION

In present days cryptography has become a common term in most circles due to its constant
employment in a ever more globalized world, where more information is exposed through the
different channels of communications and security has become a primary issue for users of
these mediums.

This paper has allowed for a better understanding of the mechanics behind cryptography and
in specific, the role played by algebra when performing these transformations on messages to
obtain secure codes that can be shared without the intrusion of third parties.

Cryptography makes use of the properties of an equation, expressing the relationship of two
expressions, original message (M) and encrypted message (C) through the implementation of
a key (K):

M → encryption K → C → decryption K → M

Algebra plays a primary role on defining the key (K) to both encrypt and decrypt the
information, algebra defines the rules on the application of a series of operations of adding,
subtracting, multiplying, dividing and its different variations with the purpose of transforming
an initial value to a different one.

While some of the examples that were review are very basic exercises, it is only intended to
give a brief idea on how cryptography works, yet it opens a door for all the possibilities and
complexities that algebraic rules and procedures allow.

As our understanding of mathematics increases, technology develops and more computing


capabilities are possible, surely more complex cryptography systems are to be developed.
Cryptography is an excellent example of the implementation of algebra in daily life by
providing a secure medium in which users can freely interchange information.
REFERENCES

• W. Diffle and M. E. Hellman. Privacy and authentication: An introduction to


cryptography. Proceedings of the IEEE, 67:397-427, March 1979.

• 刘鑫 & Nicholas A. HOUSTON. Lecture Notes on Linear Algebra. Beijing University

of Technology BJUT 2021

• Stallings, William. Cryptography and Network Security: Principles and Practice.


Prentice Hall 1990.

• Commercial National Security Algorithm Suite and Quantum Computing FAQ U.S.
National Security Agency, January 2016.

• Neso Academy. Polyalphabetic Cipher (Vigenère Cipher). Youtube. Retrieved


December 22, 2021, from https://www.youtube.com/watch?v=Ic4BzVggNY8

• Mathispower4U. Cryptography: Transposition Cipher. Youtube. Retrieved December


22, 2021, from https://www.youtube.com/watch?v=sHsnH1u03e4

• Art of the Problem. Public Key Cryptography: RSA Encryption Algorithm. Youtube.
Retrieved 22, 2021, from https://www.youtube.com/watch?v=wXB-V_Keiu8

• Modern Cryptographic Algorithms: Function & Effectiveness. Retrieved from


https://study.com/academy/lesson/modern-cryptographic-algorithms-function-
effectiveness.html. Accessed 25 December 2021.

• Britannica, The Editors of Encyclopedia. "cryptography". Encyclopedia Britannica,


Invalid Date, https://www.britannica.com/topic/cryptography. Accessed 28 December
2021.

You might also like