Sei sulla pagina 1di 86

Mathematics in the Modern World

De La Salle-College of Saint Benilde

ENCRYPTION
&
DECRYPTION

Geoffrey Reuel J. Pasague


ENCRYPTION & DECRYPTION
Learning Outcomes: Upon completion of this module, you should
have

Knowledge

1. understood the term encryption and decryption;


2. characterized and articulated about the various types of
encryption and decryption, its origin and how it has evolved over
time;
3. explored the usefulness and significance of encryption and
decryption over the years and its integration in other fields of
discipline;
4. discerned and identified a message given a ciphertext and vice-
versa;
ENCRYPTION & DECRYPTION

Learning Outcomes: Upon completion of this module, you should


have

Skills

5. confidently encrypted and decrypted messages using ciphers;


6. integrated technology to code and decode messages using
ciphers;
7. developed and created a well-thought-of original cipher code of
their own and use this code to encrypt and decrypt a message;
ENCRYPTION & DECRYPTION
Learning Outcomes: Upon completion of this module, you should
have

Values

7. realized the relevance and importance of secure


communication;
8. appreciated the beauty of mathematics in the form of code
patterns; and
9. resolved and judged appropriately the moral issues that go
with encryption and decryption.
ENCRYPTION & DECRYPTION
MATERIALS NEEDED: scientific calculator, notes for note
taking, Microsoft Excel

YOUR OUTPUT: To demonstrate the depth of learning and


validate the concepts of plaintexts and ciphers, you are required
to create, present in the class and submit individually, your own
ciphers. A rubric will be used to evaluate the developed ciphers.
ENCRYPTION & DECRYPTION

What if the Axis Powers won World War II!

https://www.youtube.com/watch?v=ur3iGrDTTE4

https://www.youtube.com/watch?v=-3G0McSHRoU
ENCRYPTION & DECRYPTION

https://www.youtube.com/watch?v=TYX691q2J2c

https://www.youtube.com/watch?v=_C25CwNlVjA
ENCRYPTION & DECRYPTION

23 June 1912 – 7 June 1954) A British scientist, mathematician, computer


scientist, logician, cryptanalyst, philosopher, theoretical biologist, and a
pioneer in computer science. Turing is widely considered to be the father of
theoretical computer science and artificial intelligence. During World War II,
he developed a machine that helped break the German Enigma code. He also
laid the groundwork for modern computing and theorized about artificial
intelligence.
CRYPTOLOGY
The study of codes or the art of writing and
solving them

CRYPTOGRAPHY CRYPTANALYSIS
The art and science of keeping The art and science of breaking
message secure encoded data
In cryptography, we start with the unencrypted data, referred
to as plaintext. Plaintext is encrypted into ciphertext, which will
in turn (usually) be decrypted back into usable plaintext.
Suppose we have a plaintext(P) intended to be transmitted, the message to be
encrypted.

Ciphertext is denoted by C and sometimes the same size as plaintext P or


sometimes larger or smaller.

However, encryption function (or key) E, operates on P to produce C.


 

Mathematically, this is given as:


(1)
In the reverse process, the decryption function (or key) D operates on C to
produce P:
(2)

Since the objective of encrypting and then decrypting a message is to recover


the original plaintext, then substituting (1) in (2) gives
Modern cryptography concerns itself with the following
five objectives:

1) Confidentiality: the information cannot be understood


by anyone for whom it was unintended
Modern cryptography concerns itself with the following five
objectives:

2) Integrity: the information cannot be altered in storage or


transit between sender and intended receiver without the
alteration being detected
Modern cryptography concerns itself with the following five
objectives:

3) Authentication: the sender and receiver can confirm each


other’s identity and the origin/destination of the information
Modern cryptography concerns itself with the following five
objectives:

4) Authorization: establish level of access for trusted parties


Modern cryptography concerns itself with the following five
objectives:

5) Non-repudiation: it provides assurance of the origin or delivery


of data in order to protect the sender against false denial by the
recipient that the data has been received, or to protect the
recipient against false denial by the sender that the data has been
sent.
History of Cryptography

The roots of cryptography : Roman and Egyptian civilizations.

Hieroglyph − The Oldest Cryptographic Technique


─ first known evidence of cryptography can be traced to the use of ‘hieroglyph’. Some 4000
years ago, the Egyptians used to communicate by messages written in hieroglyph. This code
was the secret known only to the scribes who used to transmit messages on behalf of the
kings. Some of these hieroglyphs are shown below.
Classical Types of Ciphers:

I. Concealment ciphers-is used to hide messages in plain sight. In


other words, a message within a message.

Example 1.

“I have been trying to buy you a nice gift like gold or an antique
but prices now are really high.”

Key: Use every sixth word

Decrypted Message: buy gold now


Example 2.

MATWRLD students take take the cryptography


lessons very seriously. They study aa good five hours a
day, each day. They can break
break many of the classical
ciphers.

Key: third word in each sentence matters


take
a
You can also choose to abreak
pattern:

Example 3

S a Gail
Susan says i llies. Matt
a lets e jovial.
t sSusan feel v eElated? Angry?
n

Using the pattern (1,2,3,1,2,3 [each letter in each word]) gives

message: “Sail at seven.”


2. Substitution Ciphers-a letter or character is
systematically used to replace another letter or
character or pairs of letters, triplets of letters,
mixtures of the above, and so forth. Julius Caesar
100BC-44BC

a. Caesar’s cipher, shift cipher, Caesar's code or Caesar shift –cyclical shift of the
plaintext alphabet which uses shift of 3(the shift parameter is used as the key).
Julius Caesar used to send encoded and secure messages to generals in the
Roman army.

Plain: 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

Cipher: D  E F GH I J KLM NO P Q R S T U VW X Y Z A B C
When encrypting, a person looks up each letter of the
message in the "plain" line and writes down the
corresponding letter in the "cipher" line. Julius Caesar
100BC-400BC

Plain: 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

Cipher: D E F G H I J K LM N O P Q R S T U V W X Y Z A B C

Plaintext: DCODE
Ciphertext: GFRGH

Deciphering is done in reverse.


 Using Modular Arithmetic

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
0 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

Carl Friedrich Gauss


1777-1855

To compute C + D, for example, we convert C and D to numbers and get 2 + 3 = 5,


then convert 5 back into a letter (F)
 Using Modular Arithmetic

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
0 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

Carl Friedrich Gauss


1755-1855
 

Example 2.

Encode: ATTACK AT DAYBREAK


Carl Friedrich Gauss
1755-1855

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
0 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

To compute C + D, for example, we convert C and D to numbers and get 
2 + 3 = 5, then convert 5 back into a letter (F)
 

Carl Friedrich Gauss


1755-1855

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
0 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

_________________________________________________________
Example 2.

Suppose we use a shift of 5

DECRYPT THE FOLLOWING MESSAGE:

RJJY DTZ FY YMJ HTWSJW

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
0 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

17 9 9 24 3 19 25 5 24 24 12 9 7 19 22 18 9 22

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
____________________________________________________________________
12 4 4 19 -2 14 20 0 19 19 7 4 2 14 17 13 4 17

MESSAGE: MEET YOU AT THE CORNER


 

b. Affine Cipher: a type of monoalphabetic substitution cipher, 


wherein each letter in an alphabet is mapped to its numeric equivalent.

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
0 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
 

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
0 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
 

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
0 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
 Example 1. Encode the message HELLO, key (3,7)

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
0 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

H E L L O
7 4 11 11 14

2
H
 Example 1. Encode the message HELLO, key (3,7)

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
0 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

H E L L O
7 4 11 11 14
 Example 1. Encode the message HELLO, key (3,7)

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
0 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

H E L L O
7 4 11 11 14

40
40 26(1) + 14
L
 Example 1. Encode the message HELLO, key (3,7)

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
0 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

H E L L O
7 4 11 11 14

49
40 26(1) + 23
O
Therefore, the ciphertext of HELLO is CTOOX!
 Example 2. Encode the message I AM A SECRET, key (15,7)

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
0 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

I AM A S E C R E T
8 0 12 0 18 4 2 17 4 19
 Example 2. Encode the message I AM A SECRET, key (15,7)

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
0 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

I AM A S E C R E T
8 0 12 0 18 4 2 17 4 19
 Example 2. Encode the message I AM A SECRET, key (15,7)

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
0 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

I AM A S E C R E T
8 0 12 0 18 4 2 17 4 19
Example 2. Encode the message I AM A SECRET, key (15,7)

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
0 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

Repeating this process,

I A M A S E C R E T
8 0 12 0 18 4 2 17 4 19 Plaintext

23 7 5 7 17 15 11 2 15 6 Ciphertext
X H F H R P L C P G
 Example 3. Encode the message RUN, key (7,5)

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
0 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

R U N
17 20 13

124
 Example 3. Encode the message RUN, key (7,5)

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
0 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

R U N
17 20 13

145
145
 Example 3. Encode the message RUN, key (7,5)

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
0 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

R U N
17 20 13

96
96
N

Hence, UPS is the ciphertext of RUN


 Example 4. Decode the message X HF H RPLCPG, key (15,7)

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
0 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

.
.
.
 
inverse

. . . . .
. . . . .
. . . . .
 
 Example 4. Decode the message X HF H RPLCPG, key (15,7)

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
0 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
 Example 4. Decode the message X HF H RPLCPG, key (15,7)

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
0 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
Example 4. Decode the message X HF H RPLCPG, key (15,7)

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
0 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

Repeating this process,

23 7 5 7 17 15 11 2 15 6 Ciphertext
X H F H R P L C P G

I A M A S E C R E T
8 0 12 0 18 4 2 17 4 19 Plaintext
c. The Atbash cipher (600 B.C.)is a particular type of
monoalphabetic monoalphabetic cipher formed by taking the
alphabet and mapping it to its reverse, so that the first letter
becomes the last letter, the second letter becomes the second to last
letter, and so on. For example, the English alphabet would work like
this:
Plain: 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

Cipher: Z Y X W V U T S RQ P O N M L K J I H G F E D C B A

History: The name derives from the first, last, second, and second to
the last Hebrew letters(Aleph-Tav-Beth-Shin)
In the Bible

Several biblical verses are described by


commentators as being examples of Atbash:

Jeremiah 25:26 – “The king of Sheshach shall drink after them”


‒ Sheshach meaning Babylon in Atbash (‫)ששך=בבל‬ 
Jeremiah 51:1 ‒ “Behold, I will raise up against Babylon, and
against the inhabitants of Lev-kamai, a destroying wind.”
‒Lev-kamai meaning Chaldeans(‫)לבקמי=כשדים‬
Jeremiah 51:41 ‒ “How has Sheshach been captured! and the praise
of the whole earth taken! How has Babylon become a curse among
the nations!”
‒ Sheshach meaning Babylon (‫)ששך=בבל‬
Example 1.
Plain: 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

Cipher: Z Y X W V U T S RQ P O N M L K J I H G F E D C B A

Plaintext: ATTACK AT DAWN

Ciphertext: ZGGZXP ZG WZDM

Example 2.

Decode the following message:

MVEVI HFIIVMWVI

Decoded Message:

NEVER SURRENDER
Example 3.

Decipher the message:

XVIZ VK DHDF QPH

Key: Caesar shift 4, then use Atbash cipher

A B C D E FG H I J K LM N O PQ R S T U V W X Y Z

E F G H I J K L M N O P Q R ST U V W X Y Z A B C D

D C BAZYXWVUTS R Q PO N M LK J I H G F E

Message:

GIVE IT AWAY NOW


d. Pigpen Cipher(18th century)-also known as the masonic cipher, Freemason’s cipher,
napoleon cipher, and tic-tac-toe cipher is a geometric simple substitution cipher, which
exchanges letters for symbols which are fragments of a grid.

Freemason letters
d. Pigpen Cipher(18th century)-also known as the masonic cipher, Freemason’s
cipher, napoleon cipher, and tic-tac-toe cipher is a geometric simple substitution
cipher, which exchanges letters for symbols which are fragments of a grid.

The Standard Pigpen Cipher

Represents “A” Represents “T”

   Represents “M” Represents “W”


Examples:
Use the standard Pigpen Cipher to decrypt these words.

1.

Decrypted word:

PARALLELOGRAM

2.

Decrypted word:

QUADRILATERAL
Variations of the Pigpen Cipher
Standard Pigpen Cipher Variation 1

This variant uses a Grid, X, Grid, X


layout to position the letters
Variations of the Pigpen Cipher
Standard Pigpen Cipher Variation 2

This form places the letters alternately in


the dot and non-dot parts to split adjacent
letters
Variations of the Pigpen cipher
Standard Pigpen Cipher

Variation 3

Another version, using the three grids this time.


e. The Vigenere Cipher-originally described by
Giovan Battista Bellaso in 1553 but was named for
Blaise de Vigenere as he developed a stronger
autokey cipher
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
0 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
Example:
Encrypt SAVETHEQUEEN with keyword BLADE
The numbers for the keyword is (1 11 0 3 4)

Plain text S A V E T H E Q U E E N

x 18 0 21 4 19 7 4 16 20 4 4 13
Keystream 1 11 0 3 4 1 11 0 3 4 1 11
19 11 21 7 23 8 15 16 23 8 5 24
Cipher text T L V H X I P Q X I F Y
e. The Vigenere Cipher-originally described by
Giovan Battista Bellaso in 1553 but was named for
Blaise de Vigenere as he developed a stronger
autokey cipher
-a poly-alphabetic substitution
that uses a key and a table. It allows replacing a
letter by another one which is not always the same.
The Vigenere Cipher Table

Blaise de Vigenere
1523-1596
How to encrypt using the table:

Blaise de Vigenere
1523-1596

Plaintext: DCODE
Key: KEY

1. Choose a keyword. Repeat this key phrase over and over until it is the
same length as the plaintext.
Plaintext: DCODE
Key: KEYKE
How to encrypt using the table:

Blaise de Vigenere
1523-1596

Plaintext: DCODE
Key: KEYKE

2. Locate the first letter of the plaintext message in the first line of the table
and the first letter of the key on the left column. The cipher letter is at the
intersection.
Intersection cell is N.
How to encrypt using the table:

Blaise de Vigenere
1523-1596

Plaintext: DCODE
Key: KEYKE

3. Locate the second letter of the plaintext message in the first line of the
table and the second letter of the key on the left column. The cipher letter is
at the intersection.
Intersection cell is G.
How to encrypt using the table

Blaise de Vigenere
1523-1596

Plaintext: DCODE
Key: KEYKE

3. Continue this procedure, until the last letter of the plaintext is paired
correspondingly with the last letter of the key.

Ciphertext: NGMNI
How to decrypt using the table

Blaise de Vigenere
1523-1596

Key: KEYKE
Ciphertext: NGMNI

1. Locate the first letter of the key on the first column, and on the row of it, find
the first letter of the ciphertext which is N. Then go up in the column to read
the first letter of the plaintext.
The letter is D.
How to decrypt using the table

Blaise de Vigenere
1523-1596

Key: KEYKE
Ciphertext: NGMNI

2. Locate the second letter of the key on the first column, and on the row of it, find
the second letter of the ciphertext which is G. Then go up in the column to read
the second letter of the plaintext.
The letter is C.
How to decrypt using the table

Blaise de Vigenere
1523-1596

Key: KEYKE
Ciphertext: NGMNI

3. Continue this procedure, until the last letter of the key is paired
correspondingly with the last letter of ciphertext.

Plaintext: DCODE
 
Using Modular Arithmetic
To encrypt:
Plaintext: DCODE
Key: KEYKE

Blaise de Vigenere
1523-1596
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
0 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

Plaintext
+
Key
__________________________________________

38/26=1R12

N G M N I Ciphertext
 Using Modular Arithmetic

To decrypt
Ciphertext: NG M N I
Key: KE Y K E
Blaise de Vigenere
1523-1596

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
0 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
Ciphertext

Key
__________________________________________

− 12+26=14
D C O D E Plaintext
Example 2.
Encode the message “IT WAS EARTH ALL ALONG” with the keyword “APES

Blaise de Vigenere
1523-1596

Plaintext: I T WA S E A RT H A L L A L O N G
Key: AP E S A P E S A P E S A P E S A P
Ciphertext: I I A  S S T E J T W E D L P P G N V
Example 2.
Decode the message “I I A S S T E J T W E D L P P G N V” with the keyword
“APES

Blaise de Vigenere
1523-1596

Key: A P E S A P E S A P E S A P E S A P
Ciphertext: I I A S S T E J T W E D L P P G N V
Plaintext: I T W A S E A R T H A L L A L O N G
Example 2. Modular Arithmetic
Blaise de Vigenere
Encode the message “It was Earth all along” with the keyword “APES” 1523-1596

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
0 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
To decode the message, we simply subtract the repeated code word
from the ciphertext.

Blaise de Vigenere
1523-1596

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
0 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
3. Transposition Ciphers

data encryption scheme in which plaintext characters are reordered


in some way/or just moved around, fixed by a given rule(the key)
a. Scytale Cipher
-a transposition cipher that consists of two identical wooden
cylinders around which you wrap a strip of leather or parchment
and write your message. When you unwrap the strip the message is
scrambled and can only be read if someone with an identical
cylinder uses it to read the message.
b. The rail fence cipher
-a transposition cipher that jumbles up the order of the letters.
-plain text is written downwards and diagonally on successive "rails" of an
imaginary fence, then moving up when we reach the bottom rail. When we reach
the top rail, the message is written downwards again until the whole plaintext is
written out. The message is then read off in rows

https://www.youtube.com/watch?v=VRiN9M0v3ZQ
c. The Route Cipher
d. Columnar Transposition Cipher
e. Myszkowski Transposition Cipher
f. Permutation Cipher
Quantum cryptography
exploit the laws of quantum mechanics to send messages that are provably unhackable.

QUANTUM CRYPTOGRAPHY AT WORK


The miniature transmitter communicates with a trusted authority to generate random
cryptographic keys to encode and decode information. In 2013, researchers used devices
like this to send information securely over the electric grid.
Codes and music

https://www.youtube.com/watch?v=axE4lNL8uuk

https://www.youtube.com/watch?v=CiS8gbkDISY
REFERENCES:
1. Nocon E. & Nocon R. (2016). Essential Mathematics for the
Modern World. Quezon City: C&E Publishing, Inc.
2. http://pages.mtu.edu/~shene/NSF-4/Tutorial/VIG/Vig-Base.
html
3. https://learncryptography.com/classical-encryption/playfair
-cipher
4. https://www.youtube.com/watch?v=VRiN9M0v3ZQ

5. https://www.youtube.com/watch?v=TYX691q2J2c
Thank you very much!