0% found this document useful (0 votes)
3 views

Comp-security-chapter 3Part1

Chapter Three of the Computer Security course at Mekdela Amba University covers the fundamentals of cryptography, including basic terms, historical background, cipher techniques, and cryptanalysis. It emphasizes the importance of cryptography in securing sensitive information through encoding and decoding messages, highlighting key concepts such as plaintext, ciphertext, encryption, and decryption. The chapter also discusses various cryptographic systems and the significance of confidentiality, integrity, authentication, and non-repudiation in information security.

Uploaded by

getasewwube3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Comp-security-chapter 3Part1

Chapter Three of the Computer Security course at Mekdela Amba University covers the fundamentals of cryptography, including basic terms, historical background, cipher techniques, and cryptanalysis. It emphasizes the importance of cryptography in securing sensitive information through encoding and decoding messages, highlighting key concepts such as plaintext, ciphertext, encryption, and decryption. The chapter also discusses various cryptographic systems and the significance of confidentiality, integrity, authentication, and non-repudiation in information security.

Uploaded by

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

Mekdela Amba University

College of Computing and Informatics


Department of Computer Science

Welcome to CoSc 4035


Computer Security

Chapter Three
Cryptography Fundamentals

Mekdela Amba University By


1
Leweyehu Y.
Outline
Basic cryptographic terms
Historical background
Cipher Techniques
Cryptanalysis
Conventional encryption algorithms
Cryptographic Systems

Mekdela Amba University By


2
Leweyehu Y.
What is cryptography?
 Cryptography derives from the Greek words
"kryptos" (hidden) and "grapho" (to write).
 It involves techniques for encoding and
decoding messages.
• In simple terms, "cryptography" refers to
the art of securing sensitive information
using mathematical algorithms.
• These algorithms stop third parties,
commonly known as enemies or hackers, to
peek into your data.
Mekdela Amba University By
3
Leweyehu Y.
Cryptography Cont’d…
• To avoid unauthorized access to information communicated
between parties, cryptography uses encryption and
decryption methods.

• According to American cryptographer and computer


security expert Bruce, cryptography is "the art and
science of keeping messages secure."
• The cryptography method transforms plain text into
encrypted text (aka ciphertext) using the encryption
key, and the target receiver can decrypt it using a
unique decryption key.

Mekdela Amba University By


4
Leweyehu Y.
Cryptography Cont’d…
 Cryptography is the process of converting simple plain
text into secret text called ciphertext, and converting
ciphertext back to its original simple text.
 The process uses algorithms known as crypto-algorithms
to perform the encryption and decryption process.
 Encryption and decryption are done using a "key" or
"code.“
 Sometimes, only one key is used to perform both
encryption and decryption, and sometimes two separate
keys are used, one for encryption and the other for
decryption.

Mekdela Amba University By


5
Leweyehu Y.
Cryptography Cont’d…
• Cryptography is the practice and study of hiding
information.

• It is the art or science of converting plain intelligible


data into an unintelligible data and again retransforming
that message into its original form.

• It provides Confidentiality, Integrity, and Accuracy.

Mekdela Amba University By


6
Leweyehu Y.
Basic cryptographic terms
• plaintext - the original message

• ciphertext - the coded message

• cipher - algorithm for transforming plaintext to ciphertext

• Secret key - info used in cipher known only to sender/receiver(Used to set


some or all of the various parameters used by the encryption)

• encipher (encryption) - converting plaintext to ciphertext

• decipher (decryption) - Recovering plaintext from the ciphertext

• cryptography - study of encryption principles/methods

• cryptanalysis (codebreaking) - the study of principles/ methods of


deciphering ciphertext without knowing key(The study of breaking the code
or the key).

• cryptology - the field of both cryptography and cryptanalysis

Mekdela Amba University By


7
Leweyehu Y.
Cont’d…
• Cryptography has five ingredients:
– Plaintext
– Encryption algorithm
– Secret Key
– Ciphertext
– Decryption algorithm
• Security depends on the secrecy of the
key, not the secrecy of the algorithm

Mekdela Amba University By


8
Leweyehu Y.
Cont. …
Simplified Encryption Model

Mekdela Amba University By


9
Leweyehu Y.
Description
• A sender S wanting to transmit message M to a
receiver R

• To protect the message M, the sender first encrypts


it into an unintelligible message M’

• After receipt of M’, R decrypts the message to obtain


M

• M is called the plaintext(What we want to encrypt)

• M’ is called the ciphertext (The encrypted output)

Mekdela Amba University By


10
Leweyehu Y.
Notation
• Given
– P=Plaintext
– C=Ciphertext
– k=key shared by sender and receiver
• C = EK (P) Encryption
• P = DK (C) Decryption

Mekdela Amba University By


11
Leweyehu Y.
Historical Background of cryptography
History: Caesar Cipher
• Caesar Cipher: The earliest known
example of a substitution cipher in
which each character of a message is
replaced by a character three position
down in the alphabet.
– Plaintext: are you ready
– Ciphertext: duh brx uhdgb

Mekdela Amba University By


12
Leweyehu Y.
Cont. …
• If we represent each letter of the alphabet by an
integer that corresponds to its position in the
alphabet:

– The formula for replacing each character ‘p’ of the


plaintext with a character ‘c’ of the ciphertext can
be expressed as:
c = E3(p ) = (p + 3) mod 26

Mekdela Amba University By


13
Leweyehu Y.
Cont. …
• A more general version of this cipher that allows for any
degree of shift:

– c = Ek(p ) = (p + k) mod 26

• The formula for decryption would be

– p = Dk(c ) = (c - k) mod 26

• In these formulas

– ‘k’ is the secret key. The symbols ’E’ and ’D’ stand for Encryption and
Decryption respectively, and p and c are characters in the plain and
cipher text respectively.

Mekdela Amba University By


14
Leweyehu Y.
History Cont’d…
Enigma
• Before war broke out in 1939 the
Germans had planned a special way of
keeping their communications secret.

• The army, navy and air force were


told to encode their messages using

cipher machines called ENIGMA.

Mekdela Amba University By


15
Leweyehu Y.
Cont. …
• Enigma could put a message into
code in over 150 MILLION
MILLION MILLION different
ways.

• The Germans believed that no one


could crack the Enigma code.

• But the Allies knew that if they


could, they would be able to find
out their enemy's military secrets.

Mekdela Amba University By


16
Leweyehu Y.
Cont. …
• In the 1930's Polish cipher
experts secretly began to
try to crack the code. Just
before war broke out they
managed to pass models and
drawings of Enigma to
British and French code-
breakers.
• Later Enigma was broken.

Mekdela Amba University By


17
Leweyehu Y.
History: Sigaba
• It was suited for fixed station
secure communications, and used
by U.S. for high-level
communications, was the only
machine system used by any
participant to remain completely
unbroken by an enemy during
World War II.

Mekdela Amba University By


18
Leweyehu Y.
History: People in Breaking Codes
• Bletchley Park was
the home of the
secret Government
Code and Cypher
School.
• This was the center
of British code-
breaking during the
war.

Mekdela Amba University By


19
Leweyehu Y.
Cont. …
• The code-breakers in Bletchley
Park were specially chosen from
among the cleverest people in
England.
• Some were brilliant
mathematicians or linguists.
• Alan Turing, a Cambridge
mathematician and code-breaker
who helped to invent one of the
world's first computers at
Bletchley Park.

Mekdela Amba University By


20
Leweyehu Y.
Cont’d…
Early civilizations: Cryptography has been practiced
since ancient times, with evidence of its use dating back
to around 1900 BC in Egypt and 1500 BC in Mesopotamia.

 Initially, it served various purposes like creating


mystery, protecting commercial recipes, or conveying
secret messages in military campaigns.

 Simple forms of cryptographic methods, such as


monoalphabetic substitutions, were employed.

Mekdela Amba University By


21
Leweyehu Y.
Cont’d…
Classical Cryptography: Throughout history,
cryptography mainly relied on manual methods utilizing
pen and paper or basic mechanical devices.

 More sophisticated electro-mechanical machines


emerged in the early 20th century, followed by the
advent of electronics and computing, leading to
increasingly complex cryptosystems.

Mekdela Amba University By


22
Leweyehu Y.
Cont’d…
 Cryptanalysis: Alongside the evolution of
cryptography, cryptanalytic techniques have
progressed significantly over centuries.

 Methods like frequency analysis helped reveal


hidden meanings within encrypted texts,
impacting historical events such as the United
States entering World War I upon discovering
the Zimmermann Telegram.

Mekdela Amba University By


23
Leweyehu Y.
Cont’d…
 Government dominance: Before recent advancements,
cryptography was primarily controlled by governments
due to its strategic importance and the expense
associated with developing secure systems.

 However, two critical developments led to bringing


cryptography into the public sphere – the
establishment of a public encryption standard (DES)
and the invention of public-key cryptography.

Mekdela Amba University By


24
Leweyehu Y.
Cont’d…
 Mathematical foundation: With the publication of
Claude E. Shannon's groundbreaking paper "A
mathematical theory of cryptography" in 1949,
modern cryptography gained momentum.

 Shannon laid down the principles of securing digital


communications through cryptographic methods
focusing on confidentiality and data integrity.

Mekdela Amba University By


25
Leweyehu Y.
Cont’d…
 Recent adoption: Due to increasing dependence on
digital platforms for daily activities, including
finance, commerce, and personal communication,
cryptography has become essential in maintaining
privacy and ensuring secure transmissions across
networks.

 Public-key cryptography plays a crucial role in


safeguarding sensitive information exchanged via the
internet while preserving user privacy.

Mekdela Amba University By


26
Leweyehu Y.
Cryptanalysis

 The objective of attacking an encryption system is to


recover the key in use rather than simply to recover
the plaintext of a single cipher text.
 There are two general approaches to attacking a
conventional encryption scheme.
 Cryptanalysis and Brute-force attack.

Mekdela Amba University By


27
Leweyehu Y.
Cryptanalysis cont’d…
 It is the practice of examining and attempting to
break cryptographic systems in order to access the
contents of encrypted messages, even if the
cryptographic key is unknown.

 This type of attack exploits the characteristics of


the algorithm to attempt to deduce a specific
plaintext or to deduce the key being used.

 Cryptanalytic attacks rely on the nature of the


algorithm plus perhaps some knowledge of the
general characteristics of the plaintext or even some
sample plaintext–cipher text pairs.

Mekdela Amba University By


28
Leweyehu Y.
Cont’d…
Ciphertext-only attack: In this type of attack, the
cryptanalyst only has access to the ciphertext (the
encrypted message) and needs to deduce the key or
plaintext without any additional information.

Mekdela Amba University By


29
Leweyehu Y.
Cont’d…
Known-plaintext attack: In this scenario, the attacker has
access to both the ciphertext and corresponding plaintext
pairs. Using this information, the analyst attempts to
derive the encryption key or discover patterns that could
help break future ciphertexts.

Mekdela Amba University By


30
Leweyehu Y.
Cont’d…
 Chosen-plaintext attack: Here, the attacker can
select specific plaintexts to be encrypted and
observe the corresponding ciphertexts.
 This allows the analyst to gather more detailed
information about the encryption algorithm and
potentially uncover vulnerabilities.

Mekdela Amba University By


31
Leweyehu Y.
Cont’d…
• A chosen-ciphertext attack is a scenario in which an

attacker has the ability to choose ciphertexts.


• It is similar to a chosen-plaintext attack, but applied to
a decryption function rather than an encryption
function.

Mekdela Amba University By


32
Leweyehu Y.
Cont’d…
 Brute force attack: The attacker tries every possible key

on a piece of ciphertext until an intelligible translation

into plaintext is obtained.

 On average, half of all possible keys must be tried to

achieve success.

Mekdela Amba University By


33
Leweyehu Y.
Cont’d…
Exhaustive Key Search
• The attacker attempts all possible keys, starting from the first key
and moving sequentially through to the last.
No Prior Knowledge Needed
• This method does not require any prior knowledge about the
plaintext, the key, or the encryption algorithm.
Time and Resource Intensive
• The time required to successfully perform a brute force attack
increases exponentially with the key length. Longer keys
significantly increase the number of possible combinations.

Mekdela Amba University By


34
Leweyehu Y.
why study cryptography?
• In today’s Internet world, cryptography applications are
used to enable digital signatures, money transfers, online
shopping, online booking, and credit card payments, where
authentication and privacy are crucial.
• Cryptography makes transactions on the web more secure
through digital certificates (e.g., SSL Certificate), and
other encryption technology.
• With the rise in government surveillance of Internet
data, which is making headlines every day, people are even
more concerned about their privacy and personal data.
Mekdela Amba University By
35
Leweyehu Y.
Cont’d…
• Human being from ages had two inherent needs:

-To communicate and share information and

-To communicate selectively (to communicate secretly


with selective recipients)

• These two needs gave rise to the art of coding the


messages in such a way that only the intended people
could have access to the information.

• Unauthorized people could not extract any information,


even if the scrambled messages fell in their hand.
Mekdela Amba University By
36
Leweyehu Y.
Cont’d…
• So, the art and science of covering the messages to introduce
secrecy in information security is recognized as cryptography.
• It is the study of how to alter a message so that someone
intercepting it cannot read it without the appropriate
algorithm and key.
• It is the study of secure communication techniques that allow
only the sender and intended recipient of a message to view
its contents.
• It refers to the design of mechanisms based on mathematical
algorithms that provide fundamental information security
services.
Mekdela Amba University By
37
Leweyehu Y.
Security Services of cryptography
o The primary objective of using cryptography is to provide the following

four fundamental information security services:

 Confidentiality: It is a security service that keeps the information from

an unauthorized person and it is sometimes referred to as privacy or

secrecy.

 Data Integrity: Integrity service confirms that whether data is intact or

not since it was last created, transmitted, or stored by an authorized user.

 Authentication: It confirms to the receiver that the data received has

been sent by an identified and verified sender.

 Non-repudiation: It is an assurance that the original creator of the data

cannot deny the transmission of the said data to a recipient or third party.

Mekdela Amba University By


38
Leweyehu Y.
Cryptography Algorithms
• In cryptography, encryption and decryption are
performed using a mathematical function, often known as
cryptographic algorithm.

• The mathematical function consists of keys: a word,


number, or phrase, and the cryptographic algorithm makes
use of one or more of these keys to encrypt the data.

• The strength of the encryption depends on the keys and


the cryptographic algorithm, which makes use of these
keys to encrypt.
Mekdela Amba University By
39
Leweyehu Y.
Types of Cryptography Algorithms
The three main types of algorithms:
1. Symmetric Key (Private Key) Cryptography: Uses a single key for
both encryption and decryption, which is also called symmetric
encryption. It is primarily used for privacy and confidentiality.

2. Asymmetric Key (Public Key) Cryptography: Uses one key for


encryption and another different key for decryption and is also called
asymmetric encryption. It is primarily used for authentication, non-
repudiation, and key exchange.

3. Hash Functions: Uses a mathematical transformation that


transforms the message into a fixed length data that is unique to the
corresponding source.
Mekdela Amba University By
40
Leweyehu Y.
Cont’d…

Mekdela Amba University By


41
Leweyehu Y.
Cont’d…

Mekdela Amba University By


42
Leweyehu Y.
Symmetric Cryptography
• Symmetric cryptography, known also as secret key
cryptography, is the use of a single shared secret to share
encrypted data between parties.
• In simple terms, the sender encrypts data using a password,
and the recipient must know that password to access the data.
• Symmetric Encryption is a two-way process. With a block of
plaintext and a given key, symmetric ciphers will always
produce the same ciphertext.
• Symmetric Encryption is useful for protecting data between
parties with an established shared key and is also frequently
used to store confidential data.

Mekdela Amba University By


43
Leweyehu Y.
Cont’d…
• Symmetric cryptography methods employ a single key for
both encryption and decryption.
• Symmetric keys are also known as secret keys and the
sender uses the key to encrypt the plaintext and sends
the ciphertext to the receiver.
• The receiver then applies the same key to decrypt the
message and recover the plaintext.
• Because a single key is used for both functions, it is called
symmetric encryption.

Mekdela Amba University By


44
Leweyehu Y.
Cont’d…

Mekdela Amba University By


45
Leweyehu Y.
Cont’d…

Mekdela Amba University By


46
Leweyehu Y.
Common Symmetric Algorithms
Some of the most popular crypto algorithms are:

• AES (Advanced Encryption Standard)

• DES (Data Encryption Standard)

• IDEA (International Data Encryption Algorithm)

• Blowfish (Drop-in replacement for DES or IDEA)

• RC4 (Rivest Cipher 4)

• RC5 (Rivest Cipher 5)

• RC6 (Rivest Cipher 6)

Mekdela Amba University By


47
Leweyehu Y.
Advantages of Symmetric Encryption
Some advantages of symmetric encryption include:
• Security: Symmetric encryption algorithms like AES
take billions of years to crack using brute-force
attacks.
• Speed: Because of its shorter key lengths and relative
simplicity compared to asymmetric encryption, it is
much faster to execute.
• Industry adoption and acceptance: Symmetric
encryption algorithms like AES have become the gold
standard of data encryption because of their security.

Mekdela Amba University By


48
Leweyehu Y.
Asymmetric Cryptography
Asymmetric cryptography is scalable for use in very large and ever expanding
environments where data are frequently exchanged between different
communication partners.

• Each user has two keys: Public Key and Private Key and Both keys are
mathematically related (both keys together are called the key pair).

• The public key is made available to anyone and the private key is Kept
Secret.

• Data encrypted with the Public Key is unencrypted with the Private Key.

• Encrypting data with the private key creates a digital signature and this
ensures the message has come from the stated sender (because only the
sender has access to the private key to be able to create the signature).

Mekdela Amba University By


49
Leweyehu Y.
Cont’d…
• Asymmetric cryptography is often used to exchange the secret key
to prepare for using symmetric cryptography to encrypt data.

• In the case of a key exchange, one party creates the secret key and
encrypts it with the public key of the recipient.

• The receiver would then decrypt it with their private key and the
remaining communication would be done with the secret key being the
encryption key.

• Asymmetric encryption uses two separate keys: a public key and a


private key and often a public key is used to encrypt the data while a
private key is required to decrypt the data.

• The private key is only given to users with authorized access. As


a result, asymmetric encryption can be more effective, but it is also
Mekdela Amba University By
more costly. Leweyehu Y.
50
Cont’d…

Mekdela Amba University By


51
Leweyehu Y.
Cont’d…
Examples of asymmetric encryption include:
- Rivest Shamir Adleman (RSA)
- The Digital Signature Standard (DSS)
- Digital Signature Algorithm (DSA)
-Elliptical Curve Cryptography (ECC)
-The Diffie-Hellman exchange method

Mekdela Amba University By


52
Leweyehu Y.
Advantages of Asymmetric Encryption
Advantages of using asymmetric encryption include:
 Key distribution not necessary: securing key distribution
channels has long been a headache in cryptography. Asymmetric
encryption eliminates key distribution entirely.
 Exchange of private keys not necessary: with asymmetric
encryption, private keys should remain stored in a secure location
and thus private to the entities using them.
 Digital signature/message authentication: with asymmetric
encryption, senders can use their private keys to digitally sign and
verify that a message or file originated from them and not an
untrusted third party.

Mekdela Amba University By


53
Leweyehu Y.
Hash Function
 Hash functions represent a third cryptography type alongside
symmetric and asymmetric cryptography, what we might call keyless
cryptography.
 Hash functions, also referred to as message digests, do not use a
key, but instead create a largely unique and fixed-length hash
value, commonly referred to as a hash, based on the original
message, something along the same lines as a fingerprint. Any
slight change to the message will change the hash.
 Hashes cannot be used to discover the contents of the original
message, or any of its other characteristics, but can be used to
determine whether the message has changed.

 In this way, hashes provide integrity, but not confidentiality.


Mekdela Amba University By
54
Leweyehu Y.
Cont’d…
 A Hashing Algorithm is a mathematical formula that takes a
Message of arbitrary length as input and produces as output
a representational sample of the original data.

 For instance, a rudimentary example of a hashing algorithm


is simply adding up all the letter values of a particular
message. (A=1, B=2, C=3, etc.)

Mekdela Amba University By


55
Leweyehu Y.
Cont’d…
 The result of a hashing algorithm is called a message
Digest (or sometimes Checksum, or Fingerprint). The
result of our example hashing on the original message of
hello was 52.

 If someone were to change our original message and


process it through the same hashing algorithm, the
result would be different.

Mekdela Amba University By


56
Leweyehu Y.
Cont’d…
 Hashes are very useful when distributing files or sending
communications, as the hash can be sent with the message so
that the receiver can verify its integrity.
 The receiver simply hashes the message again using the same
algorithm, then compares the two hashes. If the hashes
match, the message has not changed.
 If they do not match, the message has been altered.
 Although it is theoretically possible to engineer a matching
hash for two different sets of data (called a collision), this is
a very difficult task indeed, and generally requires that the
hashing algorithm be broken in order to accomplish.

Mekdela Amba University By


57
Leweyehu Y.
Cont’d…

Mekdela Amba University By


58
Leweyehu Y.
Hash Function Algorithms
Some common hashing algorithms include:
• MD5, SHA-1, SHA-2, NTLM, and LANMAN.
• MD5: This is the fifth version of the Message Digest
algorithm.
• MD5 creates 128-bit outputs.
• MD5 was a very commonly used hashing algorithm.

Mekdela Amba University By


59
Leweyehu Y.
Cont’d…

Mekdela Amba University By


60
Leweyehu Y.
Cont. …
Keyless Original
plaintext ciphertext plaintext

Encryption Decryption

Symmetric key

Original
plaintext ciphertext plaintext
Encryption Decryption

Asymmetric key
Original
plaintext ciphertext plaintext
Encryption Decryption
Mekdela Amba University
61
By Leweyehu Y.
Classical Encryption Techniques
There are two basic building block of all
encryption techniques:

Mekdela Amba University By


62
Leweyehu Y.
Substitution Technique
 Substitution technique is a classical encryption method
where the characters in the original message are
replaced by other characters, numbers, or symbols.
 If the plain text (original message) is considered as the
string of bits, then the substitution technique would
replace bit patterns of plain text with the bit patterns
of the cipher text.
Substitution Techniques
 Caesar Cipher
 Monoalphabetic Cipher
 Polygraphic Cipher
 Playfair Cipher
 One-Time Pad
 Hill Cipher

Mekdela Amba University By


63
Leweyehu Y.
Cont’d…
o A substitution technique is one in which the letters of
plaintext are replaced by other letters or by numbers or
symbols.
o If the plaintext is viewed as a sequence of bits, then
substitution involves replacing plaintext bit patterns with
cipher text bit patterns.

Mekdela Amba University By


64
Leweyehu Y.
Substitution Technique: Caesar Cipher
• It is one of the earliest and simplest methods of
encryption technique.
• It's a type of substitution cipher, i.e., each letter of
a given text is replaced by a letter some fixed
number of positions down the alphabet.
• For example, with a shift of 1 (Key=1), A would be
replaced by B, B would become C, and so on.
• To cipher a given text, we need an integer value,
known as shift, which indicates the number of
positions each letter is to be shifted.
• The encryption can be represented using modular
arithmetic by first transforming the letters into
numbers, according to the scheme, A = 0, B = 1, ..., Z
= 25.
Mekdela Amba University By
65
Leweyehu Y.
Caesar Cipher Cont’d…
 A shift may be of any amount, so that the general
Caesar algorithm is
C = E(k, p) = (p + k) mod 26
where k takes on a value in the range 1 to 25.
The decryption algorithm is simply :
p = D(k, C) = (C - k) mod 26

Mekdela Amba University By


66
Leweyehu Y.
Cont’d…
Example 1
• Text (P): ATTACKATONCE
• Shift (Key): 4
• Cipher (C): EXXEGOEXSRGI
Workout
• Plain Text: MEET ME TOMORROW
• Key: 3
• Cipher (C): ??????

Mekdela Amba University By


67
Leweyehu Y.
Substitution Technique: Monoalphabetic Cipher
 Monoalphabetic cipher is a substitution cipher, where
the cipher alphabet for each plaintext alphabet is fixed
for the entire encryption.
 In simple words, if the alphabet ‘p’ in the plaintext is
replaced by the cipher alphabet ‘d’.
 then in the entire plaintext, wherever alphabet ‘p’ is
used, it will be replaced by the alphabet ‘d’ to form the
ciphertext.

Mekdela Amba University By


68
Leweyehu Y.
Monoalphabetic Cipher Cont’d…

Mekdela Amba University By


69
Leweyehu Y.
Substitution Technique: Polyalphabetic Cipher
 In the monoalphabetic ciphers (shift, substitution) we
have looked at so far, we have always replaced a single
plaintext letter with the same ciphertext letter.
 This makes this cipher highly vulnerable to frequency
analysis.
 To increase security, we can change the cipher alphabet
as we are enciphering the message.
 A polyalphabetic cipher is a cipher where different
substitution alphabets are used for various parts of the
plaintext message.

Mekdela Amba University By


70
Leweyehu Y.
Polyalphabetic Cipher Cont’d…

 A polyalphabetic cipher is any cipher based on substitution,


using multiple substitution alphabets.

 In polyalphabetic substitution ciphers, the plaintext letters


are enciphered differently based upon their installation in
the text.

 Rather than being a one-to-one correspondence, there is a


one-to-many relationship between each letter and its
substitutes.

 The Vigenère cipher is probably the best-known example of a


polyalphabetic cipher, though it is a simplified special case.
Mekdela Amba University By
71
Leweyehu Y.
Vigenere Cipher

Mekdela Amba University By


72
Leweyehu Y.
Substitution Technique: Playfair Cipher
 Playfair cipher is a substitution cipher which involves a
5x5 matrix.
• Let us discuss the technique of this Playfair cipher with
the help of an example:
• Plain Text: HELLO
• Key: MONARCHY
Now We have to convert this plain text to ciphertext
using the given key. We will discuss the further process in
steps.
• Step 1: Create a 5x5 matrix and place the key in that
matrix row-wise from left to right. Then put the
remaining alphabets in the blank space.

Mekdela Amba University By


73
Leweyehu Y.
Playfair Cipher Cont’d…
• 5x5 Matrix of Letters Based on a Keyword
• Fill in letters of keyword:
– Key: MONARCHY
• Fill rest of matrix with other letters:
MO N A R
CH Y E B
FG I L P
QS T U V
WX

Mekdela Amba University By


74
Leweyehu Y.
Playfair Cipher Cont’d…
 Pair cannot be made with same letter. Break the letter
in single and add a bogus letter to the previous letter.
 Plain Text: HELLO
 After Split: 'he' 'lx' 'lo'
 Here 'x' is the bogus letter.
2. If the letter is standing alone in the process of pairing,
then add an extra bogus letter with the alone letter.
Plain Text: HELLO
After Split: 'he' 'lx' ‘ox‘
Here ‘x' is the bogus letter.

Mekdela Amba University By


75
Leweyehu Y.
Cont’d…

Mekdela Amba University By


76
Leweyehu Y.
Cont’d…

Mekdela Amba University By


77
Leweyehu Y.
Cont’d…

Mekdela Amba University By


78
Leweyehu Y.
Substitution Technique: Hill Cipher
In the Hill cipher is a polygraphy substitution cipher based on
linear aclassical cryptography, algebra.

It was first polygraphy cipher in which it was practical (though


barely) to operate on more than three symbols at once.

To encrypt a message, each block of n letters (considered as an n-


dimensional vector) is multiplied by an invertible n x n matrix,
against modulo 26.

The matrix used for encryption is the cipher key, and it should be
chosen randomly from the set of invertible n x n matrices (modulo
26).

Mekdela Amba University By


79
Leweyehu Y.
Cont’d…

Mekdela Amba University By


80
Leweyehu Y.
Cont’d…

Mekdela Amba University By


81
Leweyehu Y.
Substitution Technique: One-Time Pad
 One-Time Pad algorithm is also known as Vernam Cipher
and it is a method of encrypting alphabetic plain text.

 It is one of the substitution techniques which converts


plain text into ciphertext.

 In this mechanism, we assign a number to each


character of the plaintext.

 The relation between the key and plain text: In this


algorithm, the length of the key should be equal to that
of the plain text.

Mekdela Amba University By


82
Leweyehu Y.
One-Time Pad Cipher Cont’d…
 One-time pad cipher is a type of Vigenère cipher which
includes the following features:

 It is an unbreakable cipher.

 The key is exactly the same as the length of the message


which is encrypted.

 The key is made up of random symbols.

 As the name suggests, the key is used one time only and
never used again for any other message to be encrypted.

Mekdela Amba University By


83
Leweyehu Y.
Why is it Unbreakable?
The key is unbreakable owing to the following features:

 The key is as long as the given message.

 The key is truly random and specially auto-generated.

 Key and plain text calculated as modulo 26.

 Each key should be used once and destroyed by both


sender and receiver.

 There should be two copies of the key: one with the


sender and one with the receiver.

Mekdela Amba University By


84
Leweyehu Y.
Cont’d…

Mekdela Amba University By


85
Leweyehu Y.
Transposition Cipher
 Transposition cipher, simple data encryption scheme in
which plaintext characters are rearranged according to
some regular pattern to form ciphertext.
 In manual systems, transpositions are generally carried
out with the aid of an additional mnemonic.
 All the techniques examined so far involve the
substitution of a ciphertext symbol for a plaintext
symbol.
 A very different kind of mapping is achieved by
performing some sort of permutation on the plaintext
letters. This technique is referred to as a transposition
cipher.
Mekdela Amba University By
86
Leweyehu Y.
Cont’d…
The simplest such cipher is the rail fence technique, in which
the plaintext is written down as a sequence of diagonals and
then read off as a sequence of rows.
 For example, to encipher the message “meet me after the
toga party” with a rail fence of depth 2,
 We write the following:

The encrypted message is : MEMATRHTGPRYETEFETEOAAT

Mekdela Amba University By


87
Leweyehu Y.
Cont’d…
Algorithm :rail fence
Plaintext: Hello
Example: Depth:3
Ciphertext : ?

Mekdela Amba University By


88
Leweyehu Y.
Thank You!

Mekdela Amba University By


89
Leweyehu Y.

You might also like