0% found this document useful (0 votes)
45 views24 pages

Lec 4

Uploaded by

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

Lec 4

Uploaded by

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

Classical Cipher

Classical Substitution Ciphers


The two basic building blocks of all encryption techniques
are substitution and transposition.

A substitution technique is one in which the letters of


plaintext are replaced by other letters or by numbers or
symbols.
If the plaintext is viewed as a sequence of bits, then
substitution involves replacing plaintext bit patterns with
ciphertext bit patterns
Mono-alphabetic Cipher
A mono-alphabetic substitution cipher is a type of
substitution cipher where each letter in the plaintext
is replaced by a corresponding letter in the ciphertext.

The key feature of this cipher is that the substitution


remains consistent throughout the entire message—
each letter from the plaintext alphabet always maps
to the same letter in the ciphertext alphabet.
Caesar Cipher
The Caesar cipher, also known as a shift cipher, is one
of the simplest and most widely known encryption
techniques.

It is a type of substitution cipher where each letter in


the plaintext is shifted by a certain number of places
down or up the alphabet.

The first attested use in military affairs of one was by


Julius Caesar, described by him in Gallic Wars.
How Caesar Cipher Works
The Caesar cipher operates on the alphabetic text,
replacing each letter in the plaintext with a letter
found by moving a certain number of positions to the
right or left within the alphabet.

Encryption Process

Plaintext: The original message you want to encrypt.


Key: The number of positions each letter in the
plaintext will be shifted.
Ciphertext: The encrypted message.
How Caesar Cipher Works
Let’s break it down step by step:

• You pick a key (which is the number of shifts).


•For each letter in the plaintext, you shift it by the
value of the key.

For example, with a key of 3:


•A becomes D
•B becomes E
•C becomes F ...and so on.
How Caesar Cipher Works
Example:
Let's encrypt the word HELLO with a key of 3.
Shift each letter by 3 positions:

1. H→K
2. E→H
3. L→O
4. L→O
5. O→R

Ciphertext: KHOOR
How Caesar Cipher Works
Decryption Process
To decrypt the message, the same process is reversed.
You subtract the key from each letter to return to the
original plaintext.
For example, to decrypt KHOOR with a key of 3:
•K → H
•H → E
•O → L
•O → L
•R → O
Thus, the decrypted plaintext is HELLO.
How Caesar Cipher Works
Caesar Cipher is a method in which each letter in the
alphabet is rotated by three (key) letters as

ABCDEFGHIJKLMNOPQRSTUVWXYZ

DEFGHIJKLMNOPQRSTUVWXYZABC

Let us try to encrypt the message


“Attack at Dawn” using key 4
Class Work

Each student will exchange a secret message with


his/her closest neighbor about some other person in
the class and the neighbor will decipher it.
Mathematical Representation
The Caesar cipher can be represented mathematically. Let’s
assume:
P = Plaintext character (as a number from 0 to 25, where A =
0, B = 1, ..., Z = 25)

C = Ciphertext character
K = Key (number of shifts)
The encryption function is: C = (P+K) mod 26
The decryption function is: P = (C−K) mod 26
Example:

If P = 7 (representing H) and K = 3, the ciphertext


would be: C = (7+3) mod 26 = 10 corresponds to
K in the alphabet.

Class Work

howdy (7,14,22,3,24) encrypted


using key f (ie a shift of 5) is?????
Requirements
Two requirements for secure use of symmetric
encryption:
• A strong encryption algorithm
• A secret key known only to sender / receiver
•Mathematically have:
Y = E(K, X)
X = D(K, Y)
•Assume encryption algorithm is known
•Implies a secure channel to distribute key
Strengths of Caesar Cipher
Despite being a simple cipher, the Caesar cipher has a
few strengths:
1.Easy to Understand and Implement: It’s an excellent
teaching tool to explain basic cryptographic principles.
2.Fast Encryption/Decryption: Due to its simplicity, it
requires minimal computational power.
3.Low Storage and Memory Requirements: No special
hardware or complex algorithms are needed.
4.Basis for Other Ciphers: The Caesar cipher is the
foundation for more complex encryption methods and
ciphers.
Weaknesses of Caesar Cipher
The Caesar cipher is not secure in modern cryptography. Its
weaknesses include:
1.Limited Key Space: There are only 25 possible keys (since
shifting by 26 brings you back to the same alphabet). An attacker
can try all possible shifts (brute-force attack) and easily break the
cipher.
2.Letter Frequency Analysis: Since the Caesar cipher preserves
letter frequency, it's vulnerable to frequency analysis. In English,
certain letters (like 'E' and 'T') appear more frequently, and these
patterns can be exploited to crack the cipher.
3.Predictable Shifting: Once the key is discovered, the entire
cipher becomes exposed, making it easy to decrypt.
4.No Use of Modern Cryptographic Techniques: It does not
provide confidentiality, integrity, or authentication as required in
modern communication standards.
Breaking the Caesar Cipher
Let’s break a Caesar cipher-encrypted message using brute force
or frequency analysis:
•Example of Brute Force Attack:
•Given the ciphertext: LIPPS, we try all possible shifts:
•With key 1: KHOOR
•With key 2: JGNNQ
•With key 3: IFMMP
•With key 4: HELLO (we recognize this as valid English text).
•Therefore, the key is 4, and the plaintext is HELLO.
Example of Frequency Analysis:
•If we know that the letter E is the most common in English, we
can look for the most frequent letter in the ciphertext and
assume it maps to E. We then calculate the shift and decrypt the
rest of the message.
Improving the Caesar Cipher
To improve the Caesar cipher and address its
weaknesses, more complex encryption techniques can
be applied, such as:
1.Vigenère Cipher: Uses a keyword to vary the shift
amount at each position in the plaintext.
2.Modern Cryptographic Algorithms: Algorithms like
AES (Advanced Encryption Standard) use much more
complex and secure methods for encryption.
Monoalphabetic Cipher
The Caesar cipher isn't very secure because it only has
25 possible keys. To make the encryption much
stronger, we can use a method called arbitrary
substitution.
Before explaining, let's define a permutation. A
permutation is a specific arrangement of a set of
elements where each element appears exactly once.
For example, if you have a set S={a,b,c} the possible
arrangements (permutations) of these elements are:

abc, acb, bac, bca, cab, cba


Monoalphabetic Cipher
A permutation of the alphabet is used to create the
substitution. A permutation is simply a rearrangement
of the letters in the alphabet. For possible ways to
arrange these letters, which gives a huge number of
possible keys. This makes the cipher much stronger
than something like a Caesar cipher example, if you
have 26 letters, there are 26! (factorial).
Example:
Plaintext Alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Ciphertext Alphabet: YHKQGXPJWFNEDBMZTOCIVLASRU
Here, the permutation is such that:
A → Y, B → H, C → K, D → Q ... Z → U
Monoalphabetic Cipher
Example in Use:

Plaintext: “CRYPTOGRAPHY"
Ciphertext: "KIUDCZIXYDFU“

In this example, "C" in the plaintext always maps to


"K" in the ciphertext, "R" always maps to "I," and so
on, following the permutation.
Monoalphabetic Cipher

Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN

Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA

Decrypt this one?

Cipher text: BHHQ SOVE


Plaintext: ?
Monoalphabetic Cipher Security
Now have a total of 26! = 4 x 1026 keys.
With so many keys, might think is secure but would
be !!!WRONG!!!
Problem is language characteristics
Example:
Imagine the word "HELLO" appears often in a message.
Even with different keys, "H" will always be replaced by
the same letter, "E" by another, and so on. A smart
attacker can still figure out what the message says by
looking for these common patterns in the language.
Language Redundancy and Cryptanalysis

• Human languages are redundant


• Letters are not equally commonly used
• In English E is by far the most common letter
• followed by T,R,N,I,O,A,S
• Other letters like Z,J,K,Q,X are fairly rare
English Letter Frequencies

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy