100% found this document useful (1 vote)
496 views21 pages

Types of Cipher

This document provides information about different types of ciphers. It begins with an introduction defining a cipher as an algorithm for encryption or decryption. It then discusses the historical background of ciphers dating back to ancient Greece. Several specific ciphers are described, including the Caesar cipher, credit card cipher, shifting cipher, tripling cipher, affine cipher, and others. Examples are provided to demonstrate how each cipher works to encrypt and decrypt messages.

Uploaded by

dennis em
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
496 views21 pages

Types of Cipher

This document provides information about different types of ciphers. It begins with an introduction defining a cipher as an algorithm for encryption or decryption. It then discusses the historical background of ciphers dating back to ancient Greece. Several specific ciphers are described, including the Caesar cipher, credit card cipher, shifting cipher, tripling cipher, affine cipher, and others. Examples are provided to demonstrate how each cipher works to encrypt and decrypt messages.

Uploaded by

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

Republic of the Philippines

Laguna State Polytechnic University


Province Of Laguna

COLLEGE OF ENGINEERING
First Semester, Academic Year 2021-2022

GEC 104
MATHEMATICS IN THE MODERN WORLD

WRITTEN REPORT IN
TYPES OF CIPHER

Submitted by:

ARAUJO, LUIS GUILLER N.

BS ELECTRICAL ENGINEERING

Submitted to:

DR. ENRICO R. RIVANO

JANUARY 22, 2022

1
LEARNING OBJECTIVES

 Find out what a cipher is.

 Learn about the history of cipher.

 Learn about the many types of ciphers and how they function.

 Convert a ciphertext into plaintext.

 Convert plaintext to ciphertext.

LEARNING DISCUSSION

 What is Cipher?

 Historical background of Ciphers

 Caesar Cipher

 Credit Card Cipher

 Shifting Cipher

 Tripling Cipher

 Affine Cipher

 Decimation Cipher

 Monoalphabetic Cipher

 Homophonic Substitution Cipher

 Polygram Substitution Cipher

 Polyalphabetic Substitution Cipher (Vigenere Cipher)

2
 Playfair Cipher (Playfair Square)

 Hill Cipher

 Applications of Ciphers

INTRODUCTION

In cryptography, a cipher (or cypher) is an algorithm for performing encryption or decryption. To

encipher or encode is to convert information into cipher or code. "Cipher" is synonymous with

"code", as they are both a set of steps that encrypt a message.

DISCUSSION

Terminology

Plaintext: It is a simple message written by the user.

Ciphertext: It is an encrypted message after applying some technique.

Decryption: To decode or decrypt a code or cipher to plain text.

Encryption: To convert plain text into cipher; to encrypt.

HISTORICAL BACKGROUND

Enciphering and deciphering communications has traditionally been done with cipher devices or

machines. Around 400 BCE, the ancient Greeks appear to have used the earliest cipher device for

secret communications between military leaders.

3
Scytale

Scytale is a transposition cipher that consists of a cylinder with a strip of parchment wrapped

around it on which a message is inscribed. This cipher is supposed to have been used by the ancient

Greeks, particularly the Spartans, to communicate during military battles. To read the message, the

receiver uses a rod with the same diameter as the parchment.

CAESAR BOX

One of the earliest known ciphers is the "Caesar Box" or "Caesar Cipher." Julius Caesar used it to

deliver secret communications to his generals in the field when it was developed circa 100 BC. His

opponent would be unable to read any of his messages if they were intercepted. This clearly

provided him with a significant strategic edge.

Ceasar Cipher

One of the oldest forms of ciphers, named after Julius Caesar. Caesar moved each letter of his

message three letters to the right to generate what may be considered the ciphertext. It is also

regarded as a poor method of encryption since the communication is easily decoded due to its

minimal security methods.

Caesar cipher algorithm is as follows:

1. Read each alphabet of plain text.

2. Replace each alphabet with 3 places down.

3. Repeat the process for all alphabet in plain text.

4
Table 1.1 Ceasar Cipher Encryption

Plaintext: DREAM

Ciphertext: GUHDP

Figure 1.1 Ceasar Cipher Encryption

Table 1.2 Ceasar Cipher Decryption

Ciphertext: EDORW

Plaintext: BALOT

Figure 1.2 Ceasar Cipher Decryption

5
Shifting Cipher

The shift cipher is a form of a substitution cipher. Each letter in a string is shifted a fixed number of

spaces to the right (or left). If we shift the letter a one space to the right, it becomes b. If we shift

the word “Abba” one space to the right, it will return “BCCB”. The algorithm we will be writing uses

this exact principal, but also accepts an argument of n (the key), then shifts each letter to the right

by n characters.

 E denotes the encryption m is the number of letter in the alphabet

 D denotes the decryption

 x denotes the letters value

 n denotes the shift value

 i denotes the offset of the ith number of the letter

The formula of encryption is: En (x) = (x + n) mod m

Table 2.1 Shifting Cipher Encryption

Plaintext:POGI

Plaintext: P Plaintext: O Plaintext: G Plaintext: I

En (x) = (x + n) mod En (x) = (x + n) mod En (x) = (x + n) mod En (x) = (x + n) mod

6
26 x=15 n=8 26 x= 14 n=8 26 x=6 n=8 26 x=11 n=8

E8 (15)=(15+8) mod E8 (14) =(14+8) mod E8 (6)=(6+8) mod 26 E8 (11)=(11+8) mod

26 26 E8 (6) = 26

E8 (15) = 23 E8 (14) = 22 Ciphertext: O E8 (11) = 19

Ciphertext: X Ciphertext: W Ciphertext: T

The formula of decryption is: Dn (x) = (xi - n) mod m

Table 2.2 Shifting Cipher Decryption

Ciphertext: XWOT

Ciphertext: X Ciphertext: W Ciphertext: O Ciphertext: T

Dn (xi) = (x-n) mod Dn (xi) = (x-n) mod Dn (xi) = (x-n) mod Dn (xi) = (x-n) mod

26 x= 23 n=8 26 x= 22 n=8 26 x= 14 n=8 26 x= 19 n=8

D8(8) =(23-8)mod 26 D8(8) =(22-8)mod 26 D8(8) =(14-8)mod 26 D8(8) =(19-8)mod 26

D8(8) = 15 D8(8) = 14 D8(8) = 6 D8(8) = 11

Plaintext: P Plaintext: O Plaintext: G Plaintext: I

7
Credit Card Cipher

Credit card encryption is a security measure used to reduce the likelihood of credit or debit card

information being stolen. Credit card encryption involves both the security of the card, the security

of the terminal where a card is scanned, and the security of the transmission of the card’s

information between the terminal and a back-end computer system.

 Working backwards from the right side of the number (excluding the check digit if it is present) take
every other number and multiply it by 2.
 If the number exceeds 9 (i.e. it has double digits) then add the two numbers together. Alternatively
you can also take away 9 which does the same thing.
 Add everything together.
 Using luhn algorithm, use modulo 10 or modular arithmetic 10.
 Divide (a) in a mod10.
 If the result is zero then card number is valid.

Table 3.1 Credit Card Cipher Encryption

Determine whether 5234-8213-3410-1298 is a valid credit card number.

5 2 3 4 8 2 1 3 3 4 1 0 1 2 9 8

10 6 16 2 6 2 2 18

+ 1 2 6 4 7 2 2 3 6 4 2 0 2 2 9 8

a=60

60mod10=0 > Valid Card Number

Tripling Cipher

It's also known as the Triple Data Encryption Algorithm (3DEA) because it uses three different keys

to encrypt data at the same time. DES is a symmetric-key algorithm based on a Feistel network. It

8
uses the same key for both the encryption and decryption processes. 3DES is a more secure

alternative to DES, which only grants 56-bits of security. In 3DES, the DES algorithm is run through

three times with three keys, however it is only considered secure if three separate keys are used.

Figure 2.1 Tripling Cipher Encryption and Decryption

The Triple DES breaks the user-provided key into three subkeys as k1, k2, and k3. A message is

encrypted with k1 first, then decrypted with k2 and encrypted again with k3.

Affine Cipher

The affine cipher is a type of monoalphabetic substitution cipher. Each letter in the alphabet is

mapped to its numeric equivalent, encrypted using a simple mathematical function, and converted

back to a letter. The formula means each letter encrypts to one other letter, and back again,

meaning the cipher is essentially a standard substitution cipher with a rule governing which letter

goes to which. As such, it has the weaknesses of all substitution ciphers. Each letter is enciphered

with the function (ax + b) mod 26, where b is the magnitude of the shift.

9
 y is the numerical equivalent corresponding letter in ciphertext

 m is the number of letter in the alphabet

 k and b are chosen with some restrictions from 0,1…,m-1 (Restrictions: k must be one of

the: 1,3,5,7,9,11,15,17,19,21,23,25 because (k,26) must have only a GCD OF 1)

 x is the numerical equivalent corresponding letter in plaintext encrypts message using the

formula: y=(kx+b) mod m

Table 4.1 Affine Cipher Encryption

Plaintext ART

Plaintext: A Plaintext: R Plaintext: T

y=(kx+b) mod 26 y=(kx+b) mod 26 y=(kx+b) mod 26

k= 5 b=17 x=0 k= 5 b=17 x=17 k= 5 b=17 x=19

y=(5*0+17) mod 26 y=(5*17+17) mod 26 y=(5*19+17) mod26

y=17 y= y=112mod 26=8

Ciphertext: R Ciphertext: y Ciphertext: I

Decrypt messages using the formula: kˉ¹(y−b)mod m=x

Table 4.2 Affine Cipher Decryption

10
Ciphertext: ZEBBW

Plaintext: HELLO

Ciphertext: Z Ciphertext: E Ciphertext: B Ciphertext: W

x=kˉ¹(y−b)mod 26 x=kˉ¹(y−b)mod 26 x=kˉ¹(y−b)mod 26 x=kˉ¹(y−b)mod 26

k= 7 b=2 y= 25 k= 7 b=2 y=04 k= 7 b=2 y= 01 k= 7 b=2 y= 22

x=7ˉ¹(25−2)mod 26 x=7ˉ¹(4−2)mod 26 x= x=7ˉ¹(1−2)mod 26 x= x=7ˉ¹(22−2)mod 26

x= 15(25-2) mod 26 15(4-2) mod 26 x= 15(1-2) mod 26 x= - x= 15(22-2) mod 26

x= 345mod26 = 8 30mod26 = 4 15 mod26 = 11 x= 300mod26 = 14

Plaintext: H Plaintext: E Plaintext: L Plaintext: O

Decimation Cipher

The decimation cipher encrypts a message by using modular arithmetic. Each letter in the message

is replaced by its position in the alphabet (a → 0, b → 1, …, z → 25). These position values are then

multiplied by an encryption value.

Encrypts message using the formula: y=(kx)mod m

Table 5.1 Decimation Cipher Encryption

11
Plaintext: CARE

Plaintext: C Plaintext:A Plaintext: R Plaintext: E

y = (kx) mod26   y= (kx) mod26 y = (kx) mod26

k=7 x=2   k=7 x=17 k=7 x=4

y=(7*2)mod26   y=(7*17)mod26 y=(7*4)mod26

y=14   y=15 y=2

Ciphertext:O Ciphertext:A Ciphertext:P Ciphertext:C

Decrypts message using the formula: x=(ykˉ¹)mod m

Table 5.2 Decimation Cipher Decryption

Ciphertext: OAPC

Ciphertext: O Ciphertext:A Ciphertext: P Ciphertext: C

x=k-1 ymod26   x=k-1 ymod26 x=k-1 ymod26

k=7 y=14   k=7 y=2 k=7 y=2

x=7-1 (14)mod26   x=7-1 (15)mod26 x=7-1 (2)mod26

x=15(14)mod26 Plaintext:A x=15(15)mod26 x=15(2)mod26

x=210mod26 x=225mod26 x=30mod26

12
x=2 x=17 x=4

Plaintext:C Plaintext:R Plaintext:E

Monoalphabetic Cipher

A monoalphabetic cipher is one where each character of a plain text is mapped to a fixed other

character of cipher text. Examples include the Caesar-shift cipher and the atbash cipher. The

relationship between characters in the plain text and cipher text is one-to-one.

Monoalphabetic cipher is a cipher where the letters of the plain text are mapped to ciphertext

letters based on a single alphabetic key. It is a one to one mapping. Given plain text, the task is to

implement the monoalphabetic cipher.

Figure 3.1 Monoalphabetic Cipher Encryption

13
Homophonic Substitution Cipher

The homophonic cipher is a substitution cipher that uses a correspondence table between the

letters / characters of the plain message and one or more letters / numbers / groups of characters.

Consequently, the same letter may have several possible encryption and the same message will

possibly have several possible encrypted versions.

Encryption

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

D X S F Z E H C V I T P G A Q L K J R U O WM Y B N

9 7 3 5 0 4 6

plaintext: DEFEND THE EAST WALL OF THE CASTLE

ciphertext: F7EZ5F UC2 1DR6 M9PP 0E 6CZ SD4UP1

Decryption

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

D X S F Z E H C V I T P G A Q L K J R U O WM Y B N

9 8 3 5 0 4 6

14
2 1

Ciphertext: DAH 9TV58 U312L7B

Plaintext: ANG AKING TINAPAY

Polygram Substitution Cipher

In polygram substation cipher, rather than replacing each alphabet with another, the alphabets'

Block is replaced with another block. In this type of ciphers, plain text replacement is done through

the block by block rather than character by character.

Polyalphabetic Substitution Cipher (Vigenere Cipher)

A polyalphabetic substitution cipher is any substitution-based cipher that uses multiple substitution

alphabets. The following best describes a general algorithm that applies to any such cipher.

encryption and decryption is done using the Vigenѐre square/table .

Table 6.1 Polyalphabetic Substitution Cipher (Vigenere Cipher) Encryption

PLAINTEXT B L A C K B E A R D
Pi 1 11 0 2 10 1 4 0 17 3

15
KEYWORD O N E P I E C E O N
Ki 14 13 4 15 8 4 2 4 14 13
Ci=(Pi+Ki)mod 26 15 24 4 17 18 5 6 4 5 16
CIPHERTEXT P Y E R S F G E F Q
DECRYPTION

CIPHERTEXT K U M I M F G E F Q
Ci 10 20 12 8 12 5 6 4 5 16
KEYWORD O N E P I E C E O N
Ki 14 13 4 15 8 4 2 4 14 13
Pi=(Ci-Ki)mod26 22 7 8 19 4 1 4 0 17 3
PLAINTEXT W H I T E B E A R D

Playfair Cipher (Playfair Square)

The playfair cipher uses a 5x5 grid of letters, and encrypts a message by breaking the text into pairs

of letters and swapping them according to their positions in a rectangle within that grid: “HI”

becomes “BM”

Hill Cipher

Hill cipher is a polygraphic substitution cipher based on linear algebra. To encrypt a message, each

block of n letters is multiplied by an invertible n × n matrix, against modulus 26. Each letter is

represented by a number modulo 26 - A = 0, B = 1, …, Z = 25. The key is the matrix used for

encryption, and should be chosen randomly from the set of invertible n × n matrices.

APPLICATION OF CIPHER

16
Ciphers are used to provide encryption, authentication, and data integrity checks in file transfer

protocols like FTPS, SFTP, and WEBDAVS as well as in data-at-rest systems like OpenPGP. Modern

ciphers enable private communication in many different networking protocols, including the

Transport Layer Security (TLS) protocol and others that offer encryption of network traffic. Many

communication technologies, including phones, digital television and ATMs, rely on ciphers to

maintain security and privacy.

SUMMARY

17
At the end of the discussion, we learned to find out the following objectives:

• The definition of cipher

-To encipher or encode

- They are both a set of steps that encrypt a message.

• History of cipher

- It is traditionally done with cipher devices or machines.

- We learned that ancient Greeks used the earliest cipher device for secret communications between

military leaders.

• We identify the types of ciphers and how they function, such as;

1.) Scytale

1.1 A transposition cipher consists of a cylinder with a strip of parchment wrapped around it on which a

message is inscribed.

2). Caesar Box

2.1. Earliest known ciphers

2.2. Used to deliver secret communications

2.3. was developed circa 100 BC.

3). Caesar Cipher

3.1. It was the oldest form of Cipher and was named after Julius Caesar.

18
3.2 Its algorithm is to read each alphabet of plain text, replace each alphabet with three places down and

repeat the process for all the alphabet in plain text

4.) Shifting Cipher

4.1. It is a form of substitution cipher.

4.2. We have identified the formula of encryption, and that is: En (x) = (x + n) mod m.

5.) Credit Card Cipher

5.1 It is a security measure used to reduce the likelihood of credit or debit card information being stolen.

6.) Tripling Cipher

6.1 Triple Data Encryption Algorithm (3DEA)

6.2. This cipher uses the same key for encryption and decryption processes.

7.) Affine Cipher

7.1 This cipher is a type of monoalphabetic substitution cipher.

8.) Decimation Cipher

8.1 A cipher that encrypts a message by using modular arithmetic.

9.) Mono alphabetic Cipher

9.1 A cipher in which the plain text letters are mapped to ciphertext letters based on a single alphabetic

key.

10.) Homophobic Substitution Cipher

19
10.1 This cipher uses a correspondence table between the letters/ characters of the plain message and

on or more letters/ numbers/ groups of characters.

11.) Polygram Substitution Cipher

11.1 This is where the alphabets' block is replaced with another block.

12.) Vigenere Cipher

12.1) This is a cipher that uses multiple substitution alphabets.

13.) Playfair Square

13.1) It encrypts a message by breaking the text into pairs of letters and swapping them according to

their positions in a rectangle within a grid.

14.) Hill Cipher

14.1) We have learned that each block of n letters is multiplied by an incredible n x n matrix against

modulus.

• The discussion also concludes how to convert ciphertext into plain text and plaintext to ciphertext

20
REFERENCES

https://vivadifferences.com/monoalphabetic-cipher-vs-polyalphabetic-cipher-5-basic-difference-plus-
example/#:~:text=What%20You%20Need%20To%20Know%20About%20Monoalphabetic
%20Cipher,character%20of%20a%20cipher%20text.%20More%20items...%20

https://beautyofcodes.wordpress.com/2019/04/27/decimation-cipher/

https://www.geeksforgeeks.org/playfair-cipher-with-examples/?fbclid=IwAR0XTnM_AfN2qszAUvaRWSTquZ-
aL5DUOlpe9kXDIOhWEUFSgcnnvNYTER0

https://www.geeksforgeeks.org/hill-cipher/?
fbclid=IwAR0JdzhNaXgIQNRlsZueckdgNK00vHRuM3pQqyBUnBzplq0AKv_N_7TuJJk

https://www.educba.com/types-of-cipher/

https://alexander-virga.medium.com/ruby-simple-string-encryption-shift-caesar-cipher-encoder-rot-
9dedf06374d1#:~:text=The%20shift%20cipher%20is%20a%20form%20of%20a,one%20space%20to%20the
%20right%2C%20it%20becomes%20b.

https://images.search.yahoo.com/search/
images;_ylt=Awr9Fqo2uO5hoRUAFWmJzbkF;_ylu=c2VjA3NlYXJjaARzbGsDYnV0dG9u;_ylc=X1MDOTYwNjI4NT
cEX3IDMgRhY3RuA2NsawRjc3JjcHZpZANxYUN3d0RFd0xqTHRvd19rWGhHZ1hBS0RNVEV3TGdBQUFBRFNZcEx
SBGZyA21jYWZlZQRmcjIDc2EtZ3AEZ3ByaWQDQUgxaFNsN0NReENINmxmVHZwYnouQQRuX3N1Z2cDMTAEb
3JpZ2luA2ltYWdlcy5zZWFyY2gueWFob28uY29tBHBvcwM0BHBxc3RyA0NFQVpBUiUyMENJUEhFUgRwcXN0c
mwDMTMEcXN0cmwDMjMEcXVlcnkDY2Flc2FyJTIwY2lwaGVyJTIwdGFibGUEdF9zdG1wAzE2NDMwMzUzMT
M-?p=caesar+cipher+table&fr=mcafee&fr2=sa-gp-images.search&ei=UTF-
8&x=wrt&type=E210US91215G0#id=34&iurl=https%3A%2F%2Ffanyv88.com%3A443%2Fhttps%2Flearnlearn.uk%2Falgorithms%2Fwp-content
%2Fuploads%2Fsites%2F12%2F2017%2F01%2Fcaesar-shift-3-shift.png&action=click

https://en.wikipedia.org/wiki/Polyalphabetic_cipher

https://cangea.com/historical-cryptography-caesar-box/

https://en.wikipedia.org/wiki/Scytale

https://www.thebalance.com/what-is-credit-card-encryption-5207512#:~:text=How%20Credit%20Card

%20Encryption%20Works%20When%20you%20insert,using%20a%20decryption%20key%20to%20decipher

%20the%20cryptogram.

21

You might also like