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

Chapter-2-Symmetric Ciphers

The document discusses symmetric ciphers, focusing on their model, cryptography, and cryptanalysis techniques. It covers various substitution and transposition techniques, including the Caesar cipher, monoalphabetic ciphers, Playfair cipher, and Hill cipher. Additionally, it explains the importance of strong encryption algorithms and secure key management in maintaining the confidentiality of encrypted messages.

Uploaded by

khushpatel1222
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Chapter-2-Symmetric Ciphers

The document discusses symmetric ciphers, focusing on their model, cryptography, and cryptanalysis techniques. It covers various substitution and transposition techniques, including the Caesar cipher, monoalphabetic ciphers, Playfair cipher, and Hill cipher. Additionally, it explains the importance of strong encryption algorithms and secure key management in maintaining the confidentiality of encrypted messages.

Uploaded by

khushpatel1222
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

Symmetric Ciphers

Dr Savitha G
Dr Girisha S
Dr Ashutosh B Holla
Introduction
➢What you will study:
➢Symmetric Cipher Model
➢Cryptography
➢Cryptanalysis and brute force attack
➢Substitution Techniques
➢Caesar Cipher
➢Monoalphabetic Cipher
➢Playfair Cipher
➢Hill Cipher
➢Transposition Techniques
Introduction
➢ Symmetric encryption, also referred to as conventional encryption or single-key
encryption, was the only type of encryption in use prior to the development of
public key encryption
➢ Few terms:
 An original message is known as the plaintext, while 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
 Such a scheme is known as a cryptographic system or a cipher
 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
✓It has few components:
➢Plain Text
➢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 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
Symmetric Cipher Model
➢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
Symmetric Cipher Model
Symmetric Cipher Model
➢There are two requirements for secure use of
conventional encryption:
✓We need a strong encryption algorithm.
✓The opponent should be unable to decrypt ciphertext or
discover the key even if he or she is in possession of a
number of ciphertexts together with the plaintext that
produced each ciphertext.
✓Sender and receiver must have obtained copies of the
secret key in a secure fashion and must keep the key
secure. If someone can discover the key and knows the
algorithm, all communication using this key is readable
Symmetric Cipher Model
➢A source produces a message in plaintext, X = [X1, X2, …., XM]. The M
elements of X are letters in some finite alphabet
➢ For encryption, a key of the form K = [K1, K2, … , KJ] is generated
➢ With the message X and the encryption key K as input, the encryption
algorithm forms the ciphertext Y = [Y1, Y2, … , YN]. We can write this
as
Y= E(K, X)
➢ The intended receiver, in possession of the key, is able to invert the
transformation
X = D(K, Y)
➢ An opponent, observing Y but not having access to K or X, may attempt
to recover X or K or both X and K
Symmetric Cipher Model
Cryptography
Three independent dimensions:
➢The type of operations used for transforming plaintext to ciphertext:
 Substitution, in which each element in the plaintext (bit, letter, group of bits or letters) is
mapped into another element
 Transposition, in which elements in the plaintext are rearranged

➢The number of keys used:


 If both sender and receiver use the same key, the system is referred to as symmetric, single-key,
secret-key, or conventional encryption
 If the sender and receiver use different keys, the system is referred to as asymmetric, two-key,
or public-key encryption

➢The way in which the plaintext is processed:


 A block cipher processes the input one block of elements at a time, producing an output block for
each input block
 A stream cipher processes the input elements continuously, producing output one element at a
time, as it goes along
Cryptanalysis and Brute-Force
Attack
➢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.
➢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
Cryptanalysis and Brute-Force
Attack
Cryptanalysis and Brute-Force
Attack
➢ An encryption scheme is unconditionally secure if the ciphertext
generated by the scheme does not contain enough information to
determine uniquely the corresponding plaintext, no matter how
much ciphertext is available
➢ That is, no matter how much time an opponent has, it is impossible
for him or her to decrypt the ciphertext simply because the required
information is not there
Cryptanalysis and Brute-Force
Attack
✓ Allthat the users of an encryption algorithm can strive for is an
algorithm that meets one or both of the following criteria:
➢The cost of breaking the cipher exceeds the value of the encrypted
information
➢The time required to break the cipher exceeds the useful lifetime of the
information

❖An encryption scheme is said to be computationally secure if either of


the foregoing two criteria are met
Cryptanalysis and Brute-Force Attack
➢A brute-force attack involves trying every possible key until an
intelligible translation of the ciphertext into plaintext is obtained
➢ On average, half of all possible keys must be tried to achieve success
➢ That is, if there are X different keys, on average an attacker would
discover the actual key after X/2 tries
Example: Small Key Space (4 Keys)
Large Key Space (100 Keys)
Why does this Happen?
Substitution Techniques: Caeser Cipher
➢ TheCaesar Cipher is one of the simplest and oldest methods of encrypting
messages, named after Julius Caesar, who used it to protect his military
communications.
➢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
➢ TheCaesar cipher involves replacing each letter of the alphabet with the letter
standing three places further down the alphabet
➢ The alphabet is wrapped around so that the letter following Z is A
Substitution Techniques: Caeser
Cipher

➢ Let us assign a numerical equivalent to each letter


Substitution Techniques: Caeser
Cipher
➢Then the algorithm can be expressed as follows:
➢For each plaintext letter p, substitute the ciphertext letter C
C = E(3, p) = (p + 3) mod 26
➢ 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
Substitution Techniques: Caeser
Cipher
Substitution Techniques: Caeser
Cipher
✓Threeimportant characteristics of this problem
enabled us to use a brute-force cryptanalysis:
➢The encryption and decryption algorithms are known
➢There are only 25 keys to try
➢The language of the plaintext is known and easily
recognizable
Substitution Techniques:
Monoalphabetic Ciphers
➢ Caesar cipher: Only 25 possible key
➢ Key space can be increased by allowing an arbitrary substitution
➢A permutation of a finite set of elements S is an ordered sequence
of all the elements of S, with each element appearing exactly once
▪ For example, if S = {a, b, c}, there are six permutations of S:
▪ abc, acb, bac, bca, cab, cba

➢ Ingeneral, there are n! permutations of a set of n elements, because


the first element can be chosen in one of n ways, the second in n - 1
ways, the third in n - 2 ways, and so on
Substitution Techniques:
Monoalphabetic Ciphers

➢ The “cipher” line can be any permutation of the 26 alphabetic


characters, then there are 26! or greater than 4𝑥1026 possible keys

➢ Suchan approach is referred to as a monoalphabetic substitution


cipher, because a single cipher alphabet (mapping from plain
alphabet to cipher alphabet) is used per message
Substitution Techniques:
Monoalphabetic Ciphers
• If the cryptanalyst knows the nature of the plaintext (e.g., non-
compressed English text), then the analyst can exploit the
regularities of the language

• First step, the relative frequency of the letters can be


determined and compared to a standard frequency distribution
for English
Substitution Techniques:
Monoalphabetic Ciphers
➢ Itseems likely that cipher letters P and Z are the equivalents of plain
letters e and t, but it is not certain which is which
➢ Theletters S, U, O, M, and H are all of relatively high frequency and
probably correspond to plain letters from the set {a, h, i, n, o, r, s}
➢A powerful tool is to look at the frequency of two-letter combinations,
known as digrams
➢ The most common such digram is th
▪ In our ciphertext, the most common digram is ZW, which appears three times
▪ So we make the correspondence of Z with t and W with h

➢ Then, by our earlier hypothesis, we can equate P with e


➢ Now notice that the sequence ZWP appears in the ciphertext, and we
can translate that sequence as “the”
Substitution Techniques:
Monoalphabetic Ciphers
➢ Monoalphabetic ciphers are easy to break because they reflect the
frequency data of the original alphabet

➢A countermeasure is to provide multiple substitutes, known as


homophones, for a single letter
➢ For example, the letter e could be assigned a number of different
cipher symbols, such as 16, 74, 35, and 21, with each homophone
assigned to a letter in rotation or randomly
Substitution Techniques:
Playfair Cipher
• The best-known multiple-letter encryption cipher is the Playfair, which treats
digrams in the plaintext as single units and translates these units into
ciphertext digrams
• The Playfair algorithm is based on the use of a 5 * 5 matrix of letters constructed
using a keyword

• In this case, the keyword is monarchy


• 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
• The letters I and J count as one letter
Substitution Techniques:
Playfair Cipher
1. Repeating plaintext letters that are in the same pair are separated
with a filler letter, such as x, so that balloon would be treated as
ba lx lo on
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, ar is encrypted
as RM.
3. 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, mu is encrypted as CM.
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, hs becomes BP and ea becomes IM (or JM,
as the encipherer wishes).
Substitution Techniques:
Playfair Cipher
➢ PlainText: “instruments”
➢ Plain text is split into pairs of two letters (digraphs)
▪ Split: ‘in’ ‘st’ ‘ru’ ‘me’ ‘nt’ ‘sz’

➢ Pairscannot be made with same letters. Break the letter in single


and add a dummy letter
▪ Example: “balloon”
▪ Split: ‘ba’ ‘lx’ ‘lo’ ‘on’

➢ If
the letter is standing alone in the process of paring, then add extra
dummy letter
Substitution Techniques:
Playfair Cipher
➢ If
both the letters are in the same column: Take the letter below
each one
▪ Digraph: “me”
▪ Encryption: “cl”

➢ Ifboth the letters are in the same row: Take the letter to the right
of each one
▪ Digraph: “st”
▪ Encryption: “tl”

➢ Ifneither of the above rules is true: Form a rectangle with the two
letters and take the letters on the horizontal opposite corner of the
rectangle.
▪ Diagraph: “nt”
▪ Encryption: “rq”
Substitution Techniques: Hill
Cipher
Determinant of a matrix:
• Ex: 2x2 matrix
𝑎11 𝑎12
|𝑎 𝑎22 | = (𝑎11 × 𝑎22 - 𝑎12 × 𝑎21 )
21

• Ex: 3x3 matrix


𝑎11 𝑎12 𝑎13
𝑎21 𝑎22 𝑎23
𝑎31 𝑎32 𝑎33

𝑎22 𝑎23 𝑎21 𝑎23 𝑎21 𝑎22


= 𝑎11 𝑎 𝑎33 − 𝑎12 𝑎 𝑎33 + 𝑎13 𝑎 𝑎32
32 31 31
Substitution Techniques: Hill
Cipher
Adjoint of a matrix:
• Ex: 2x2 matrix:
𝑎11 𝑎12
𝑘= 𝑎 𝑎22
21

𝑎22 −𝑎12
𝑎𝑑𝑗 𝐾 = −𝑎 𝑎11
21

• Ex: 3x3 matrix:


 Find the minor of the matrix
 Find the cofactor of the matrix
 Find the transpose of the matrix
Substitution Techniques: Hill
Cipher
𝑎11 𝑎12 𝑎13
K= 𝑎21 𝑎22 𝑎23
𝑎31 𝑎32 𝑎33
𝑎22 𝑎23
𝐾11 = 𝑎 𝑎33 = 𝑎22 × 𝑎33 − 𝑎32 × 𝑎23
32

𝑎21 𝑎23
𝐾12 = 𝑎 𝑎33 = 𝑎21 × 𝑎33 − 𝑎31 × 𝑎23
31

𝑎21 𝑎22
𝐾13 = 𝑎 𝑎32 = 𝑎21 × 𝑎32 − 𝑎22 × 𝑎31
31


𝑎11 𝑎12
𝐾33 = 𝑎 𝑎22 = 𝑎11 × 𝑎22 − 𝑎21 × 𝑎12
21
Substitution Techniques: Hill
Cipher
• Cofactor of a matrix: + − +
− + −
+ − +

𝑎11 𝑎12 𝑎13


• K= 𝑎21 𝑎22 𝑎23
𝑎31 𝑎32 𝑎33
𝑎11 𝑎21 𝑎31
• 𝐾 𝑇 = 𝑎12 𝑎22 𝑎32
𝑎13 𝑎23 𝑎33
Substitution Techniques: Hill
Cipher (Encryption)
➢ Thisencryption algorithm takes m successive plaintext letters and
substitutes for them m ciphertext letters
➢ Thesubstitution is determined by m linear equations in which each
character is assigned a numerical value (a = 0, b = 1, c , z = 25)
Substitution Techniques: Hill
Cipher (Encryption)
➢ Where C and P are row vectors of length 3 representing the plaintext
and ciphertext, and K is a 3 * 3 matrix representing the encryption
key
➢ Operations are performed mod 26
➢ Forexample, consider the plaintext “paymoremoney” and use the
encryption key
Substitution Techniques: Hill
Cipher (Encryption)
• The first three letters of the plaintext are represented by the vector
(15 0 24)
• Then (15 0 24)K = (303 303 531) mod 26 = (17 17 11) = RRL
• Continuing in this fashion, the ciphertext for the entire plaintext is
RRLMWBKASPDH
Substitution Techniques: Hill
Cipher (Decryption)
• Decryption requires using the inverse of the matrix K
−𝟏
𝟏
𝑲 = 𝒂𝒅𝒋 𝑲
𝑲
Substitution Techniques: Hill
Cipher (Decryption)
• We can compute det K = 23
 -939 mod 26
• Formula: a mod b = a - b × floor(a/b)
-939 mod 26 = −939−26×⌊-939/26⌋
= −939−26×⌊−36.115⌋
= −939−26×(−37)
= −939+962
= 23
Substitution Techniques: Hill
Cipher (Decryption)
• Multiplicative inverse of
1
= 17
23
23* ____ mod 26 = 1
• Start from 1 and go up to 26
• We find 23*17 mod 26 =1
𝟏
• Hence, Multiplicative inverse of = 𝟏𝟕
𝟐𝟑

300 −313 267


• Calculate adjoint of K: −357 313 −252
6 0 −51
Substitution Techniques: Hill
Cipher (Decryption)
𝟏
• 𝑲−𝟏 = 𝒂𝒅𝒋 𝑲
𝑲

300 313 267


• 𝑲−𝟏 =17 * 357 313 252 mod 26
6 0 −51
4 9 15
• 𝑲−𝟏 = 15 17 6
24 0 17
Substitution Techniques: Hill
Cipher
Solved example:
➢ Consider the following plaintext: “Hello”
17 17 5
➢ Consider the following keyword: 21 18 21
2 2 19
➢ The Hill Algorithm:
➢C=E(K,P)=P x K mod 26
➢P=D(K,C)= C x 𝑲−𝟏 mod 26
Substitution Techniques: Hill
Cipher
➢ The encoded plain text is:

H E L L O
7 4 11 11 14

➢ Key is a 3x3 matrix


➢ PT: “HEL” “LOX”
Substitution Techniques: Hill
Cipher

➢ Encrypting “HEL” ➢ Encrypting “LOX”

17 17 5 17 17 5
= 7 4 11 21 18 21 𝑚𝑜𝑑26 = 11 14 23 21 18 21 𝑚𝑜𝑑26
2 2 19 2 2 19

= (225, 213, 328) mod 26 = (527, 485, 786) mod 26

= (17 5 16) = (7 17 6)

=RFQ =HRG

➢ “HELLOX” = “RFQHRG”
Substitution Techniques: Hill
Cipher
Decryption algorithm:
𝟏
➢ We need to find 𝑲−𝟏 = 𝒂𝒅𝒋 𝑲
𝑲

17 17 5
➢ Given K: 21 18 21
2 2 19
➢ Det K = 17(18*19-2*21)-17(21*19-2*21)+5(21*2-2*18) mod 26
=(5100-6069+30) mod 26
= (-939) mod 26 Formula: a mod b = a - b × floor(a/b)
-939 mod 26 = −939−26×⌊-939/26⌋
= 23 = −939−26×⌊−36.115⌋
= −939−26×(−37)
= −939+962
= 23
Substitution Techniques: Hill
Cipher
To find the Adj K
➢Find the minor of the matrix
➢Find the cofactor of the matrix
➢Find the transpose of the matrix
300 −313 267
➢ −357 313 −252 𝑚𝑜𝑑 26
6 0 −51
14 25 7
➢ Adj K= 7 1 8
6 0 1
Substitution Techniques: Hill
Cipher
14 25 7
−𝟏 𝟏
➢𝑲 = 7 1 8 𝑚𝑜𝑑 26
𝟐𝟑
6 0 1
➢ We need to find the multiplicative inverse of 23 mod 26 (Extended
Euclidean Algorithm)
Q A B R T1 T2 T
1 26 23 3 0 1 -1
7 23 3 2 1 -1 8
1 3 2 1 -1 8 -9
2 2 1 0 8 -9 26
1 0 -9 26

➢ -9 mod 26 =17 Note: A must be always greater than B


Role of T1, T2, and T in extended
Euclidean Algorithm
• T1 and T2:These are helper columns used to calculate T iteratively:
• T1 starts at 0 because it's associated with 𝑎=26 (the initial larger value).
• T2 starts at 1 because it's associated with 𝑏=23 (the initial smaller value).
• T (Main Column):T is the updated value at each step, representing the
coefficient of 𝑏 in the equation.
 This is calculated iteratively using the recurrence relation:
T=T1−Q⋅T2.
 The process ensures T tracks the evolving coefficient of 𝑏 as the algorithm
proceeds.
• Step-by-Step Calculation of T
• Step 1: For a=26,b=23 :Q=1 , remainder R=3

• Start with:
• T1=0,T2=1
• Compute T=T1−Q⋅T2
• T=0−1⋅1=−1

• At this point, we stop because the remainder is 1


(the gcd). The T value at this stage (−9)
represents the coefficient of 23 in the equation
23⋅T+26⋅T′=1
• Final Adjustment:
• Since modular arithmetic requires positive remainders:
−9 mod 26=17
• Thus, 17 is the multiplicative inverse of 23 modulo 26.
Substitution Techniques: Hill
Cipher
14 25 7
➢ 𝑲−𝟏 = 𝟏𝟕 7 1 8 𝑚𝑜𝑑 26
6 0 1

238 425 119


➢ 𝐊 −𝟏 = 119 17 136 𝑚𝑜𝑑 26
102 0 17

4 9 15
➢ 𝑲−𝟏 = 15 17 6
24 0 17
Substitution Techniques: Hill
Cipher

➢ Decrypting “RFQ” ➢ Decrypting “HRG”

4 9 15 4 9 15
= 17 5 16 15 17 6 𝑚𝑜𝑑26 = 7 17 6 15 17 6 𝑚𝑜𝑑26
24 0 17 24 0 17

= (527, 238, 557) mod 26 = (427,352,309) mod 26

= (7 4 11) = (11 14 23)

=HEL =LOX
Substitution Techniques: Hill
Cipher
• Consider the following plain text: “HELLO”
5 8
• The key is
17 3
• The Hill Algorithm:
• C=E(K,P)=P x K mod 26
• P=D(K,C)= C x 𝑲−𝟏 mod 26

𝑘11 𝑘12
• 𝑐1 𝑐2 = 𝑝1 𝑝2 𝑚𝑜𝑑 26
𝑘21 𝑘22
Substitution Techniques: Hill
Cipher
➢ The encoded plain text is:

H E L L O
7 4 11 11 14

➢ Key is a 2x2 matrix


➢ PT: “HE” “LL” “OX”
Substitution Techniques: Hill
Cipher
𝒌𝟏𝟏 𝒌𝟏𝟐
➢ 𝒄 𝟏 𝒄 𝟐 = 𝒑𝟏 𝒑𝟐 𝒎𝒐𝒅 𝟐𝟔
𝒌𝟐𝟏 𝒌𝟐𝟐

➢ Encrypting “HE” ➢ Encrypting “LL” ➢ Encrypting “HE”

5 8 5 8 5 8
= 74 𝑚𝑜𝑑26 = 11 11 𝑚𝑜𝑑26 = 14 23 𝑚𝑜𝑑26
17 3 17 3 17 3

= (103 68) mod 26 = (242 121) mod 26 = (461 181) mod 26

= (25 16) = (8 17) = (19 25)

=ZQ =IR =TZ

➢ “HELLOX” = “ZQIRTZ”
Substitution Techniques: Hill
Cipher
Decryption algorithm:
𝟏
➢ We need to find 𝑲−𝟏 = 𝒂𝒅𝒋 𝑲
𝑲

5 8
➢ Given K:
17 3
➢ Det K = (5*3 – 8*17)mod 26

= -121mod 26
Formula: a mod b = a - b × floor(a/b)
-121 mod 26 = −121−26×⌊-121/26⌋
−121−26×⌊−4.65⌋
= −121−26×(−5)
=9
Substitution Techniques: Hill
Cipher
𝟏 5 8
➢ 𝑲−𝟏 =𝟗 𝑚𝑜𝑑 26
17 3
➢ Weneed to find the multiplicative inverse of 9 mod 26 (Extended
Euclidean Algorithm)

Q A B R T1 T2 T
2 26 9 8 0 1 -2
1 9 8 1 1 -2 3
8 8 1 0 -2 3 -26
1 0 3 -26

Note: A must be always greater than B


➢3 mod 26 =3
Substitution Techniques: Hill
Cipher
Adjoint of a matrix:
• Ex: 2x2 matrix:
𝑎11 𝑎12
𝑘= 𝑎 𝑎22
21

𝑎22 −𝑎12
𝑎𝑑𝑗 𝐾 = −𝑎 𝑎11
21

5 8
• Adjoint of K =
17 3
3 −8
• =
−17 5
Substitution Techniques: Hill
Cipher
𝟏
• We need to find 𝑲−𝟏 = 𝒂𝒅𝒋 𝑲
𝑲

3 −8
• 3* mod 26
−17 5
9 −24
• = 𝑚𝑜𝑑 26
−51 15
9 2
• 𝑲−𝟏 = =
1 15
Substitution Techniques: Hill
Cipher

➢ Decrypting “ZQ” ➢ Decrypting “IR” ➢ Decrypting “TZ”

9 2 9 2 9 2
= 25 16 𝑚𝑜𝑑26 = 8 17 𝑚𝑜𝑑26 = 19 25 𝑚𝑜𝑑26
1 15 1 15 1 15

= (241 290) mod 26 = (89 271) mod 26 = (196 413) mod 26

= (7 4) = (11 11) = (14 23)

=HE =LL =OX

➢Decrypted text “HELLOX”


Transposition technique
• Performs some sort of permutation on the plaintext letters. This
technique is referred to as a transposition cipher.
• 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:
• Decryption
• The number of columns in rail fence cipher remains equal to the length of plain-
text message. And the key corresponds to the number of rails.

• Hence, rail matrix can be constructed accordingly. Once we’ve got the matrix we
can figure-out the spots where texts should be placed (using the same way of
moving diagonally up and down alternatively ).
• Then, we fill the cipher-text row wise. After filling it, we traverse the matrix in
zig-zag manner to obtain the original text.
• Example:
• Let cipher-text = “MEMATRHTGPRYETEFETEOAAT” , and Key = 2

• Number of columns in matrix = len(cipher-text) = 23


• Number of rows = key = 2
• Hence original matrix will be of 2*23 , now marking places with text as ‘*’ we
get
* _ _ _ * _ _ _ * _ _ _ *
_ * _ * _ * _ * _ * _ *
_ _ * _ _ _ * _ _ _ * _
Transposition technique-
Columnar Transposition
• 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

• Thus, in this example, the key is 4312567


• To encrypt, start with the column that is labeled 1, in this case column
3. Write down all the letters in that column. Proceed to column 4, which
is labeled 2, then column 2, then column 1, then columns 5, 6, and 7
Transposition technique
Columnar Transposition - Multiple Rounds/
Improved Columnar Transposition
• 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
Transposition technique
Columnar Transposition - Multiple Rounds/
Improved Columnar Transposition
• Designate the letters in the original plaintext message by the
numbers designating their position. Thus, with 28 letters in the
message, the original sequence of letters is
Transposition technique - Book
Cipher/Running Key Cipher
• Step 1: Convert plaintext to numeric form: A=0, B=1, C=3, ...Z=25.
• Step 2: Take a one-time pad or key from any of the books and convert it to
numeric format. But the key has to be the same length as the plain text.
• Step 3: Now combine the numeric forms of plain text and key, matching
each plaintext letter with the corresponding key text letter.
If the sum of any plaintext letter and the matching key text letter
exceeds 26, subtract 26.
Book Cipher/Running Key Cipher
Plain Text MEET T O M O R R O W
Numeric form plain text 12 4 4 19 19 14 12 14 17 17 14 12
Key Text A N E N C R Y P T I O N
Numeric form key text 0 13 4 14 2 17 24 15 19 8 14 13

• Add the numeric form of plaintext and key text. So after adding both the values we
will get 12 7 8 32 21 31 36 29 36 25 28 35 −
• Now we have some numbers in the above outcome (shown in bold) which is greater
that 26 so we will subtract these number with 26 and then the final outcome will
be − 12 17 8 6 21 5 10 3 10 25 2 9
• So the new ciphertext will be: MRIGVFKDKZDJ.
END

You might also like