2 Chapter
2 Chapter
Key points
• An original message is known as the plaintext. The coded
message is called the ciphertext.
• The process of converting from plaintext to ciphertext is known as
enciphering or encryption;
• Restoring the plaintext from the ciphertext is deciphering or
decryption.
• The many schemes used for encryption constitute the area of
study known as cryptography.
• Techniques used for deciphering a message without any knowledge
of the enciphering details fall into the area of cryptanalysis.
• The areas of cryptography and cryptanalysis together are called
cryptology.
Symmetric Cipher Model
A symmetric encryption scheme has five ingredients :
Plaintext: This is the original intelligible message or data that is fed
into the algorithm as input.
• Encryption algorithm: The encryption algorithm performs various
substitutions and transformations on the plaintext.
• Secret key: The secret key is also input to the encryption
algorithm. The key is a value independent of the plaintext and of the
algorithm. The algorithm will produce a different output depending
on the specific key being used at the time. The exact substitutions
and transformations performed by the algorithm depend on the key.
• Ciphertext: This is the scrambled message
produced as output. It depends on the
plaintext and the secret key. For a given
message, two different keys will produce two
different ciphertexts. The ciphertext is an
apparently random stream of data and, as it
stands, is unintelligible.
• Decryption algorithm: This is essentially the
encryption algorithm run in reverse. It takes the
ciphertext and the secret key and produces the
original plaintext.
Simplified model of symmetric encryption
Two Requirement of secure use of Symmetric Encryption:-
1. A secret key known by only sender and receiver
2. Strong Encryption Algorithm
• Mathematically:
• Y = E(K, X) and X = D(K, Y)
• X = plaintext
• Y = ciphertext
• K = secret key
• E = encryption algorithm
• D = decryption algorithm
Cryptanalysis and Brute-Force Attack
Typically, the objective of attacking an encryption system is to
recover the key in use rather than simply to recover the plaintext of a
single ciphertext. There are two general approaches to attacking a
conventional encryption scheme:
• Cryptanalysis: 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–ciphertext pairs. This
type of attack exploits the characteristics of the algorithm to attempt
to deduce a specific plaintext or to deduce the key being used.
• 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.
SUBSTITUTION TECHNIQUES
• The two basic building blocks of all encryption
techniques are:
1. Substitution and
2. 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.
Caesar Cipher
• The earliest known, and the simplest, use of a
substitution cipher was by Julius Caesar.
• The Caesar cipher involves replacing each
letter of the alphabet with the letter standing
three places further down the alphabet.
• It’s simply a type of substitution cipher
• 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. Encryption of a
letter by a shift n can be described
mathematically as.
• c=E(p, k) =( p+k )mod 26
(Encryption Phase with shift n)
• p=D(c, k) =(c-k) mod 26
(Decryption Phase with shift n)
• For example
a b c d e f g h i j k l m
d e f g h i j k l m n o p
n o p q r s t u v w x y z
q r s t u v w x y z a b c
• Plain Text He l l o
• Cipher Text= k ho or
• Welcome
• zh0frph
Encryption
Plain text = “Hello”
C(P)=(P+3) mod 26
C(H)=(7+3) mod 26
C(H) =10 mod 26
C(H)=10
C(H)= K
Decryption
cipher text = “khoor”
P(C)=(C-3) mod 26
P(C)=(10-3) mod 26
P(C) =7 mod 26
P(C)=7
P(C)= h
• Hacking of Caesar Cipher Algorithm
• The cipher text can be hacked with various
possibilities. One of such possibility is Brute
Force Technique, which involves trying every
possible decryption key.
• Simply try all the 25 possible keys.
• This technique does not demand much effort
and is relatively simple for a hacker.
Monoalphabetic Cipher
• Better than Caeser Cipher
• For each character of alphabet, assign different-abrupt
concerned character
• Example:
a b c d e f g h i
Z Y X W V U T S R
j k l m n o p q r
Q P O N M L K J I
S t u v w x y z
H G F E D C B A
• Monoalphabetic ciphers are easy to break
because they reflect the frequency data of the
original alphabet.
• A counter measure is to provide multiple
substitutes, known as homophones, for a
single letter
Playfair Cipher
• The best-known multiple-letter encryption cipher is the
Playfair, which treats diagrams in the plaintext as single
units and translates these units into ciphertext
diagrams.
• The Playfair algorithm is based on the use of a 5 * 5
matrix of letters constructed using a keyword.
For Example,
Keyword: security
Plaintext: pattern
• .
• In this case, the keyword is security. The
matrix is constructed by filling in the letters
of the keyword (minus duplicates) from left to
right and from top to bottom, and then filling
in the remainder of the matrix with the
remaining letters in alphabetic order.
Note: The letters I and J count as one letter
S E C U R
I/J T Y A B
D F G H K Plaintext is encrypted two letters at a
L M N O P time, according to the following rules:
Q V W X Z
2) Two plaintext letters that fall in the same row of the matrix
are each replaced by the letter to the right, with the first
element of the row circularly following the last. For
example, op is encrypted as PL.
• Two plaintext letters that fall in the same
column are each replaced by the letter
beneath, with the top element of the column
circularly following the last. For example, mv is
encrypted as VE.
4) Otherwise, each plaintext letter in a pair is replaced by
the letter that lies in its own row and the column
occupied by the other plaintext letter. Thus, pa
becomes OB.
Plaintext: pa tx te rn
Ciphertext: OB AV FT CP
Plain Text N E E L I M A
Key A U T H O R A
Cipher N Y X S W A A
Text
Key A U T H O R A
Plain Text N E E L I M A
Cipher Text N Y X S W A A
Advantages of Vigenere Cipher
• It is difficult to retrieve the plain text from the
cipher text obtained using Vigenere cipher just
by analyzing the frequency of letters in the
cipher text because Vigenere cipher
encryption method successfully avoids the
frequent appearances of the English alphabets
One-Time Pad (Vernam cipher)
• Most popular substitution cipher is the Vernam
Cipher, also called as one-time pad.
• The cipher text is unbreakable since it has no
statistical relationship to the plain text
• The key is exactly same as the length of message
which is encrypted.
• The key is made up of random symbols.
• As the name suggests, key is used one time only
and never used again for any other message to be
encrypted.
• Due to this, encrypted message will be vulnerable
to attack for a cryptanalyst. The key used for a one-
time pad cipher is called pad, as it is printed on
pads of paper.
Encryption Algorithm:
• Welcome sk 3
• Wc e
• E o come together sk 3
• L m
• Ct===wceeolm
Simple Columnar Transposition
• This sort of thing would be trivial to
cryptanalyze.
• A more complex scheme is to write the
message in a rectangle, row by row, and read
the message off, column by column,
• but permute the order of the columns. The
order of the columns then becomes the key to
the algorithm.
Key= 4 3 1 2 5 6 7
PT= attack postponed until two am
• Key: 4 3 1 2 5 6 7
• Plaintext: a t t a c k p
o s t p o n e
d u n t i l t
w o a m
Ciphertext=ttnaaptmtsuoaodwcoixknlypetz
tsuottnaaodw petaptmcoiknl
• Today heavy rain is there=PT
• 3 1 2 4 ==SK
• 3 1 2 4
• T 0 d a
• Y - h e
• A V y -
• r a i n
• - i s -
• T h e r
• e
• CT=ohynhderietyviteaaasr
• o vaihdhyiseTyar teae n r
The transposition cipher can be made significantly more
secure by performing more than one stage of transposition.
The result is a more complex permutation that is not easily
reconstructed. Thus, if the foregoing message is re-encrypted
using the same algorithm,
Key: 4 3 1 2 5 6 7
Input: t t n a a p t
mt suoao
d w coixk
n l ypetz
Ciphertext:-nscyauopttwltmdnaoiepaxttokz
STEGANOGRAPHY
• A plaintext message may be hidden in one of
two ways. The methods of steganography
conceal the existence of the message,
whereas the methods of cryptography render
the message unintelligible to outsiders by
various transformations of the text.
• Steganography is hiding of message in another
text or images
In past following techniques were used