Types of Cipher
Types of Cipher
COLLEGE OF ENGINEERING
First Semester, Academic Year 2021-2022
GEC 104
MATHEMATICS IN THE MODERN WORLD
WRITTEN REPORT IN
TYPES OF CIPHER
Submitted by:
BS ELECTRICAL ENGINEERING
Submitted to:
1
LEARNING OBJECTIVES
Learn about the many types of ciphers and how they function.
LEARNING DISCUSSION
What is Cipher?
Caesar Cipher
Shifting Cipher
Tripling Cipher
Affine Cipher
Decimation Cipher
Monoalphabetic Cipher
2
Playfair Cipher (Playfair Square)
Hill Cipher
Applications of Ciphers
INTRODUCTION
encipher or encode is to convert information into cipher or code. "Cipher" is synonymous with
DISCUSSION
Terminology
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
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
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
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
4
Table 1.1 Ceasar Cipher Encryption
Plaintext: DREAM
Ciphertext: GUHDP
Ciphertext: EDORW
Plaintext: BALOT
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.
Plaintext:POGI
6
26 x=15 n=8 26 x= 14 n=8 26 x=6 n=8 26 x=11 n=8
26 26 E8 (6) = 26
Ciphertext: XWOT
Dn (xi) = (x-n) mod Dn (xi) = (x-n) mod Dn (xi) = (x-n) mod Dn (xi) = (x-n) mod
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
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.
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
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.
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
k and b are chosen with some restrictions from 0,1…,m-1 (Restrictions: k must be one of
x is the numerical equivalent corresponding letter in plaintext encrypts message using the
Plaintext ART
10
Ciphertext: ZEBBW
Plaintext: HELLO
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
11
Plaintext: CARE
Ciphertext: OAPC
12
x=2 x=17 x=4
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
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
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
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
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
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.
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
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
SUMMARY
17
At the end of the discussion, we learned to find out the following objectives:
• History of cipher
- 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.
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
4.2. We have identified the formula of encryption, and that is: En (x) = (x + n) mod m.
5.1 It is a security measure used to reduce the likelihood of credit or debit card information being stolen.
6.2. This cipher uses the same key for encryption and decryption processes.
9.1 A cipher in which the plain text letters are mapped to ciphertext letters based on a single alphabetic
key.
19
10.1 This cipher uses a correspondence table between the letters/ characters of the plain message and
11.1 This is where the alphabets' block is replaced with another block.
13.1) It encrypts a message by breaking the text into pairs of letters and swapping them according to
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