UNIT - I (Part 2)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 109

Intro.

To Data Network Security

Classical Encryption Techniques

UNIT - I

Faculty Name: Dr. Amrita 1


Overview

1. Cryptography
2. Symmetric Cipher Model
3. Substitution Techniques
4. Transposition Techniques
5. Rotor Machines
6. Steganography

Faculty Name: Dr. Amrita 2


Cryptography
Latin
Cryptography Crypt secret
Graphia writing

• Concerned with developing algorithms:


- Conceal the context of some message from all
except the sender and recipient (privacy or secrecy)

Form the basis Form the basis


of many of many
technological technological
solution solution

Faculty Name: Dr. Amrita 3


Cryptography
• Concerned with developing algorithms:

- Verify the correctness of a message to the recipient


(authentication)

- Form the basis of many technological solution to


computer and communications security problems

cryptography - study of encryption principles/methods

Faculty Name: Dr. Amrita 4


Goals & Setting
• To ensure security of communication
across an insecure channel.

• The ideal channel:

Dedicated, untappable, impenetrable

Pipe/tube

Send Receiv
er er
Faculty Name: Dr. Amrita 5
Goals & Setting
Adversary (Attacker) The source of all
possible threats

Sender Receiver
Not all aspect of an ideal
channel can be emulated
Faculty Name: Dr. Amrita 6
Basic terminology
⚫ Plaintext: original message to be encrypted
⚫ Ciphertext: the encrypted message
⚫ Enciphering or encryption: the process of
converting plaintext into ciphertext
⚫ Encryption algorithm: performs encryption
◦ Two inputs: a plaintext and a secret key

Faculty Name: Dr. Amrita 7


Basic terminology
⚫ Deciphering or decryption: recovering
plaintext from ciphertext
⚫ Decryption algorithm: performs decryption
◦ Two inputs: ciphertext and secret key

⚫ Secret key: same key used for encryption and


decryption
◦ Also referred to as a symmetric key

Faculty Name: Dr. Amrita 8


Basic terminology
⚫ Cipher or cryptographic system : a scheme
for encryption and decryption
⚫ Cryptography: science of studying ciphers
⚫ Cryptanalysis: science of studying attacks
against cryptographic systems
⚫ Cryptology: cryptography + cryptanalysis

Faculty Name: Dr. Amrita 9


Simple Process
Sender Receiver
Plaintext Plaintext
The secret message is: The secret message is:
You can get A-/A+ in You can get A-/A+ in
SKR5200; (however depend on SKR5200; (however depend on
you) you)

Encry Decry
ption ption
ciphertext
hjfjghkf@#@#$%^&jklll
098GHJFD!@#$#$#$%

Faculty Name: Dr. Amrita 10


Categories of cryptography

Faculty Name: Dr. Amrita 11


Comparison between two categories
Comparison between two categories of cryptography

Faculty Name: Dr. Amrita 12


Encryption Method
Cryptography

Symmetric Encryption Asymmetric Encryption

•conventional / •uses two keys – a public & a


private-key / single-key private key
•sender and recipient •asymmetric since parties are
share a common key not equal
•all classical encryption •uses clever application of
algorithms are number theoretic concepts to
private-key function
•complements rather than
replaces private key crypto
Faculty Name: Dr. Amrita 13
Symmetric Encryption Technique

Symmetric Encryption

Classical Modern

Stream cipher Block cipher

Faculty Name: Dr. Amrita 14


Ciphers
⚫ Block cipher: encrypts a block of plaintext at
a time (typically 64 or 128 bits)

⚫ Stream cipher: encrypts data one bit or one


byte at a time

Faculty Name: Dr. Amrita 15


Symmetric Encryption
⚫ or conventional / secret-key / single-key
⚫ sender and recipient share a common key
⚫ all classical encryption algorithms are
symmetric
⚫ The only type of ciphers prior to the
invention of asymmetric-key ciphers in 1970’s
⚫ by far most widely used

Faculty Name: Dr. Amrita 16


Symmetric Cipher Model

Faculty Name: Dr. Amrita 17


Conventional Cryptosystem

X=[X1,X2,...,XN] X=DK(Y)

Y=EK(X)
letters from
finite alphabet
K=[K1,K2,...,KJ]

Faculty Name: Dr. Amrita 18


Symmetric Encryption
⚫ Mathematically:
Y = EK(X) or Y = E(K, X)
X = DK(Y) or X = D(K, Y)
⚫ X = plaintext
⚫ Y = ciphertext
⚫ K = secret key
⚫ E = encryption algorithm
⚫ D = decryption algorithm
⚫ Both E and D are known to public

Faculty Name: Dr. Amrita 19


Requirements
1. Need strong encryption algorithm
• always assume that eavesdropper (“Eve” or “Trudy”) knows the
details of the used algorithm (Kerkhoffs’ law)
• Eve and Trudy might acquire some plaintext/ciphertext pairs
• still, it should be (practically) impossible to determine the key (or
to determine the plaintext for a given cipher text)
• however: it is sufficient if algorithm is computationally secure (as
opposed to unconditionally secure)

2. Sender and receiver must have same secret key


• key must be distributed in a secure fashion
• if someone discovers the key, all communication is readable

Faculty Name: Dr. Amrita 20


Cryptanalysis
As cryptography is the science and art of creating
secret codes, cryptanalysis is the science and art
of breaking those codes.

Kerckhoff’s principle: the adversary knows all


details about a cryptosystem except the secret
key.

Two general approaches:


non-brute-force attack (cryptanalytic attack)

brute-force attack

Faculty Name: Dr. Amrita 21


Cryptanalysis

Figure Cryptanalysis attacks

Faculty Name: Dr. Amrita 22


Types of Cryptanalytic Attacks
⚫ ciphertext only
◦ only know algorithm / ciphertext, statistical, can
identify plaintext
⚫ known plaintext
◦ know/suspect plaintext & ciphertext to attack cipher
⚫ chosen plaintext
◦ select plaintext and obtain ciphertext to attack cipher
⚫ chosen ciphertext
◦ select ciphertext and obtain plaintext to attack cipher
◦ tries to obtain a secret key or the details about the
system.
⚫ chosen text
◦ select either plaintext or ciphertext to en/decrypt to
attack cipher. Tries to recover the key
Faculty Name: Dr. Amrita 23
Ciphertext-Only Attack

Figure Ciphertext-only attack


• Attacker knows ciphertext of several messages
encrypted with same key (but doesn’t know
plaintext).
• Possible to recover plaintext (also possible to
deduce key) by looking at frequency of ciphertext
letters
Faculty Name: Dr. Amrita 24
Ciphertext-only attack
⚫ Given: a ciphertext c
⚫ Q: what is the plaintext m?
⚫ An encryption scheme is completely
insecure if it cannot resist ciphertext-only
attacks.

Faculty Name: Dr. Amrita 25


Known-Plaintext Attack

Figure Known-plaintext attack

• Attackers observes pairs of plaintext/


ciphertext encrypted with same key.
• Possible to deduce key and/or devise
algorithm to decrypt ciphertext.

Faculty Name: Dr. Amrita 26


Known-plaintext attack
⚫ Given: (m1,c1), (m2,c2), …, (mk,ck) and a
new ciphertext c.

⚫ Q: what is the plaintext of c?


⚫ Q: what is the secret key in use?

Faculty Name: Dr. Amrita 27


Chosen-Plaintext Attack

Figure 3.6 Chosen-plaintext


attack
• Attacker can choose the plaintext and look at
the paired ciphertext
• Attacker has more control than
known-plaintext attack and may be able to
gain more information about key
Faculty Name: Dr. Amrita 28
Chosen-plaintext attack

⚫ Given: (m1,c1), (m2,c2), …, (mk,ck), where m1,


m2, …, mk are chosen by the adversary; and a
new ciphertext c.

⚫ Q: what is the plaintext of c, or what is the


secret key?

Faculty Name: Dr. Amrita 29


Chosen-Ciphertext Attack

Figure 3.7 Chosen-ciphertext


attack

select ciphertext and obtain plaintext to


attack cipher

Faculty Name: Dr. Amrita 30


Chosen-ciphertext attack
⚫ Given: (m1,c1), (m2,c2), …, (mk,ck), where
c1, c2, …, ck are chosen by the adversary;
and a new ciphertext c.

⚫ Q: what is the plaintext of c, or what is


the secret key?

Faculty Name: Dr. Amrita 31


More Definitions
⚫ Unconditional security
◦no matter how much computer power or
time is available, the cipher cannot be
broken since the ciphertext provides
insufficient information to uniquely
determine the corresponding plaintext

◦No Encryption algorithm exit that is


unconditionally secure.

Faculty Name: Dr. Amrita 32


More Definitions
⚫ Computational security
◦ given limited computing resources (eg time needed
for calculations is greater than age of universe), the
cipher cannot be broken
Criteria for computationally secure
1. The cost of breaking the cipher exceeds the value of
the encrypted information.
2. 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 above two
criteria are met.
Faculty Name: Dr. Amrita 33
Brute Force Attack (Exhaustive Search)
• always possible to simply try every key
alternative
• have to check half of all alternatives in average
• most basic form of attack, depends on key size
• must be able to recognize plaintext
Key Size Number of Time required at 1 Time required at 106
(bits) Alternative Keys decryption/µs decryptions/µs

32 232 = 4.3 × 231 µs= 35.8 minutes 2.15 milliseconds


109
56 256 = 7.2 × 255 µs= 1142 years 10.01 hours
1016
128 2128 = 3.4 × 2127 µs= 5.4 × 1024 5.4 × 1018 years
1038 years

168 2168 = 3.7 × 2167 µs= 5.9 × 1036 5.9 × 1030 years
1050 years
Faculty Name: Dr. Amrita 34
Characterization of Cryptographic Systems
• Type of encryption operations :
− The type of operations used for transforming plaintext to
ciphertext.
− substitution, transposition(permutation)
• Number of keys used
− sender and receiver use same key: symmetric
encryption
− different keys are used: asymmetric or public-key
encryption
• way in which plaintext is processed
− block cipher: one block input at a time --> one block
output
− stream cipher: process input elements continuously

Faculty Name: Dr. Amrita 35


Classical Encryption Techniques
⚫ Plaintext is viewed as a sequence of elements
(e.g., bits or characters)
⚫ Substitution cipher: replacing each element of
the plaintext with another element.
⚫ Transposition (or permutation) cipher:
rearranging the order of the elements of the
plaintext.
⚫ Product cipher: using multiple stages of
substitutions and transpositions

Faculty Name: Dr. Amrita 36


SUBSTITUTION CIPHERS
A substitution cipher replaces one letter by other
letters or by numbers or symbols.

Substitution ciphers can be categorized as either


monoalphabetic ciphers or polyalphabetic ciphers.

A substitution cipher replaces one symbol


with another.

Faculty Name: Dr. Amrita 37


Monoalphabetic Ciphers

In monoalphabetic substitution, the


relationship between a symbol in the
plaintext to a symbol in the ciphertext is
always one-to-one.

Faculty Name: Dr. Amrita 38


Polyalphabetic Ciphers

In polyalphabetic substitution, each


occurrence of a character may have a
different substitute. The relationship
between a character in the plaintext to a
character in the ciphertext is one-to-many.

Faculty Name: Dr. Amrita 39


Example
3.1
The following shows a plaintext and its corresponding
ciphertext. The cipher is probably monoalphabetic because
both l’s (els) are encrypted as O’s.

Example
3.2
The following shows a plaintext and its corresponding
ciphertext. The cipher is not monoalphabetic because each
l (el) is encrypted by a different character.

Plaintext : hello Ciphertext : KHOUR

Faculty Name: Dr. Amrita 40


Types of SUBSTITUTION CIPHERS
1. Caesar Cipher
2. Monoalphabetic Ciphers
3. Playfair Cipher
4. Hill Cipher
5. Polyalphabetic Ciphers
6. One-Time Pad

Faculty Name: Dr. Amrita 41


Additive Cipher

The simplest monoalphabetic cipher is the additive cipher.


This cipher is sometimes called a shift cipher and
sometimes a Caesar cipher, but the term additive cipher
better reveals its mathematical nature.

Figure Plaintext and ciphertext in Z26

Faculty Name: Dr. Amrita 42


Figure : Additive cipher

When the cipher is additive, the plaintext,


ciphertext, and key are integers in Z26.
Faculty Name: Dr. Amrita 43
Example
Use the additive cipher with key = 15 to encrypt
the message “hello”.
Solution :
We apply the encryption algorithm to the
plaintext, character by character:

Faculty Name: Dr. Amrita 44


Example
Use the additive cipher with key = 15 to decrypt
the message “WTAAD”.

Solution : We apply the decryption algorithm


to the plaintext character by character:

Faculty Name: Dr. Amrita 45


Shift Cipher or Caesar Cipher
Additive ciphers are sometimes referred to
as shift ciphers or Caesar cipher.

• Substitution cipher by Julius Caesar


• Used in military affairs
• Replaces each letter by 3rd letter on
• Example:

meet me after the toga party


PHHW PH DIWHU WKH WRJD SDUWB

Faculty Name: Dr. Amrita 46


Caesar Cipher
Can define transformation as:
Plain Text : 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
Cipher Text : D E F G H I J K L M N O P Q R
S T U V W X Y Z A B C
Mathematically: give each letter a number
then have Caesar cipher as:
C = E(p) = (p + k) mod (26)
p = D(C) = (C – k) mod (26)
with k = 3
in general: k = 1, 2, ..., 25
Faculty Name: Dr. Amrita 47
Cryptanalysis of Caesar Cipher
• Only have 26 possible ciphers (A maps to
A, B,..., or Z)
• Given ciphertext, just try all shifts of letters
• Exhaustive search, brute force
• However: we need to recognize when we
have plaintext
• What if plaintext is a binary file? a
compressed file?

Faculty Name: Dr. Amrita 48


Example
Eve has intercepted the ciphertext “UVACLYFZLJBYL”.
Show how she can use a brute-force attack to break the
cipher.
Solution : Eve tries keys from 1 to 7. With a key of 7, the
plaintext is “not very secure”, which makes sense.

Faculty Name: Dr. Amrita 49


Monoalphabetic Substitution Ciphers
Because additive, shift, Caesar ciphers have small key
domains, they are very vulnerable to brute-force attack.
•A better solution is to create a mapping between each
plaintext character and the corresponding ciphertext
character.
•each plaintext letter maps to a different random ciphertext
letter
Alice and Bob can agree on a table showing the mapping
for each character.

Figure : An example key for monoalphabetic substitution cipher


Faculty Name: Dr. Amrita 50
Example of Monoalphabetic substitution

⚫ In monoalphabetic substitution, the


relationship between a character in the
plaintext to the character in the ciphertext is
always one-to-one

Faculty Name: Dr. Amrita 51


Example
We can use the key in Figure to encrypt the
message

The ciphertext is

Faculty Name: Dr. Amrita 52


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

Faculty Name: Dr. Amrita 53


Language Redundancy and Cryptanalysis
⚫ human languages are redundant
⚫ eg "th lrd s m shphrd shll nt wnt"
⚫ 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
⚫ have tables of single, double & triple letter
frequencies for various languages

Faculty Name: Dr. Amrita 54


English Letter Frequencies

Faculty Name: Dr. Amrita 55


Table : Frequency of characters in English

Table : Frequency of diagrams and trigrams

Faculty Name: Dr. Amrita 56


Example
Eve has intercepted the following ciphertext. Using a
statistical attack, find the plaintext.

When Eve tabulates the frequency of letters in this


ciphertext, she gets: I =14, V =13, S =12, and so on. The
most common character is I with 14 occurrences. This
means key = 4.

Faculty Name: Dr. Amrita 57


Playfair Cipher
⚫ Not even the large number of keys in a
monoalphabetic cipher provides security
⚫ One approach to improving security was to
encrypt multiple letters (polygraphic
cipher)
⚫ the Playfair Cipher is an example for polygram
cipher
⚫ invented by Charles Wheatstone in 1854, but
named after his friend Baron Playfair
Faculty Name: Dr. Amrita 58
Playfair Key Matrix
• a 5 x 5 matrix of letters based on a keyword
• I and J are considered the same letter
• fill in letters of keyword (without duplicates)
• fill rest of matrix with other letters
• e.g., using the keyword MONARCHY

M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z

Faculty Name: Dr. Amrita 59


Encryption and Decryption
Encrypt two plaintext letters at a time:
1. if a pair is a repeated letter, insert a filler like 'X',
e.g., "balloon" encrypts as "ba lx lo on"
2. if both letters fall in the same row, replace each with
letter to right (wrapping back to start from end),
e.g., “ar" encrypts as "RM"
3. if both letters fall in the same column, replace each with
the letter below it (again wrapping to top from bottom),
e.g., “mu" encrypts to "CM”
4. otherwise, each letter is replaced by the one that lies in
its row and is located in the column of the other letter,
e.g., “hs" --> "BP", “ea" --> "IM" or "JM" (as desired)
Faculty Name: Dr. Amrita 60
Example
Figure : An example of a secret key in the Playfair cipher

Let us encrypt the plaintext “hello” using the key above.

hello 🡪 he lx lo

Faculty Name: Dr. Amrita 61


Playfair Cipher
⚫ Keyword “Infosec”

I/J N F O S

E C A B D

G H K L M

P Q R T U

V W X Y Z

Faculty Name: Dr. Amrita 62


Playfair Cipher : Example
⚫ E.g., Plaintext: “CRYPTO IS TOO EASY”
⚫ Keyword is “INFOSEC”
⚫ Grouped text: CR YP TO IS TO XO EA SY
⚫ Ciphertext: AQ VT YB NI YB YF CB OZ
⚫ To decrypt, the receiver reconstructs the
5 x 5 matrix using the keyword and then
uses the same rules as for encryption

Faculty Name: Dr. Amrita 63


Security of Playfair Cipher
• security much improved over monoalphabetic
• since we have 26 x 26 = 676 digrams
• would need a 676 entry frequency table to
analyze
(vs. 26 for monoalphabetic cipher)
• therefore, need correspondingly more ciphertext
• was widely used for many years (eg. US &
British military in WWI)
• it can be broken, given a few hundred letters
• since it still has much of the plaintext structure

Faculty Name: Dr. Amrita 64


Hill Cipher

⚫ It is a polygraphic substitution cipher based


based on linear algebra.
⚫ Invented by Lester S. Hill in 1929.
⚫ Each letter is represented by a number
modulo 26. (Often the simple scheme A = 0,
B = 1, ..., Z = 25 is used.

Faculty Name: Dr. Amrita 65


Hill Cipher
⚫ Encryption : To encrypt a message, each
block of n letters (considered as an
n-component vector) is multiplied by an
invertible n × n matrix, again modulus 26.
⚫ Decryption : To decrypt the message, each
block is multiplied by the inverse of the matrix
used for encryption.
⚫ Cipher Key :The matrix used for encryption
is the cipher key, and it should be chosen
randomly from the set of invertible n × n
matrices (modulo 26).
Faculty Name: Dr. Amrita 66
Key in the Hill cipher

The key matrix in the Hill cipher needs to


have a multiplicative inverse.

Faculty Name: Dr. Amrita 67


Encryption

c1 = (k11p1 + k12p2 + k13p3) mod 26


c2 = (k21p1 + k22p2 + k23p3) mod 26
c3 = (k31p1 + k32p2 + k33p3) mod 26

C = KP mod 26
Faculty Name: Dr. Amrita 68
Decryption
P = K-1C mod 26
where K-1 is inverse of K
i.e., K-1K = 1 mod 26

Example

Faculty Name: Dr. Amrita 69


Example
• Plaintext : 'ACT‘ .
• break the message into chunks of 3.
• create a vector that corresponds to the letters
• Since 'A' is 0, 'C' is 2 and 'T' is 19, the message
is the vector:

• The key (or GYBNQKURP in letters):

Faculty Name: Dr. Amrita 70


Example
Ciphertext : to get ciphertext, we perform a
matrix multiplication.

Thus the enciphered vector is given by:

which corresponds to a ciphertext of 'POH'.

Faculty Name: Dr. Amrita 71


Example : Decryption
In order to decrypt, we turn the ciphertext back into a
vector, then simply multiply by the inverse matrix of the key
matrix (IFKVIVVMI in letters). We find that, modulo 26, the
inverse of the matrix used in the previous example is:

Taking the previous example ciphertext of 'POH', we get:

which gets us back to 'ACT', just as we hoped.


Faculty Name: Dr. Amrita 72
Example : Hill Cipher

Faculty Name: Dr. Amrita 73


Example : Hill Cipher
The matrix K is invertible , hence K-1 exists such that KK-1
=K-1K=I2. To implement decrypting, we compute

Faculty Name: Dr. Amrita 74


Hill Cipher : Cryptanalysis
This cipher is vulnerable to known-plaintext attack because
it is completely linear. Assume that Eve knows that m = 3.
She has intercepted three plaintext/ciphertext pair blocks
(not necessarily from the same message) as shown below

Faculty Name: Dr. Amrita 75


She makes matrices P and C from these pairs.
Because P is invertible, she inverts the P matrix
and multiplies it by C to get the K matrix as shown
in Figure 3.18.

Now she has the key and can break any ciphertext
encrypted with that key.

Faculty Name: Dr. Amrita 76


Limitation of Monoalphabetic Cipher

⚫ In monoalphabetic cipher the problem was


that each character was substituted by a
single character

⚫ Cryptanalysts are helped by the fact that they


have to see what character would correspond
in plaintext for a given ciphertext character

⚫ Polyalphabetic cipher’s goal is to make this


process difficult

Faculty Name: Dr. Amrita 77


Polyalphabetic Ciphers
• In polyalphabetic substitution, each occurrence
of a character may have a different substitute.
The relationship between a character in the
plaintext to a character in the ciphertext is
one-to-many.
• Each occurrence of a character can have a
different substitute
• use multiple cipher alphabets

Faculty Name: Dr. Amrita 78


Polyalphabetic Ciphers
• makes cryptanalysis harder with more
alphabets to guess and flatter frequency
distribution
• Difficult to attack when compared to
Monoalphabetic.
• use a key to select which alphabet is used
for each letter of the message
• use each alphabet in turn
• repeat from start after end of key is
reached
Faculty Name: Dr. Amrita 79
Polyalphabetic Ciphers
Autokey Cipher

In Autokey cipher, the key is a stream of


subkeys, in which each subkey is used to encrypt
the corresponding character in the plaintext.

Faculty Name: Dr. Amrita 80


Example
Assume that Alice and Bob agreed to use an
autokey cipher with initial key value k1 = 12. Now
Alice wants to send Bob the message “Attack is
today”. Enciphering is done character by
character.

Faculty Name: Dr. Amrita 81


Cryptanalysis : Autokey

⚫ It is vulnerable to the brute-force


attack, because the first subkey can
be only one of the 26 values (00 to
25).

Faculty Name: Dr. Amrita 82


Polyalphabetic Ciphers
Vigenere Cipher
• Designed by Blaise de Vigenere.
• In this, the key stream is a repetition of an
initial secret key stream of length m, where
1<=m<=26.

Faculty Name: Dr. Amrita 83


Example
Let us see how we can encrypt the message “She
is listening” using the 6-character keyword
“PASCAL”. The initial key stream is (15, 0, 18, 2,
0, 11). The key stream is the repetition of this
initial key stream (as many times as needed).

Faculty Name: Dr. Amrita 84


Polyalphabetic Cipher
Vigenere Tableau Cipher
⚫ Another way to look at Vigenere ciphers is
through Vigenere tableau.
⚫ Vigenère cipher starts with a 26 x 26 matrix
of alphabets in sequence. First row starts
with ‘A’, second row starts with ‘B’, etc.
⚫ This cipher also requires a keyword that the
sender and receiver know ahead of time
⚫ Each character of the message is combined
with the characters of the keyword to find
the ciphertext character

Faculty Name: Dr. Amrita 85


Vigenere Tableau

Faculty Name: Dr. Amrita 86


Example :Vigenere Tableau Cipher
Encryption
⚫ E.g., Message = SEE ME IN MALL
⚫ Take keyword as INFOSEC
⚫ Vigenère cipher works as follows:
S E E M E I N M A L L
I N F O S E C I N F O
------------------------------------------
AR J A WM P UN QZ

Faculty Name: Dr. Amrita 87


Polyalphabetic Cipher
Vigenere Tableau Cipher : Decryption

⚫ To decrypt, the receiver places the


keyword characters below each
ciphertext character
⚫ Using the table, choose the row
corresponding to the keyword character
and look for the ciphertext character in
that row
⚫ Plaintext character is then at the top of
that column
Faculty Name: Dr. Amrita 88
Example :Vigenere Tableau Cipher
Decryption
⚫ Decryption of ciphertext:
A R J A W M P U N Q Z
I N F O S E C I N F O
----------------------------------------------
S E E M E I N M A L L
⚫ Best feature is that same plaintext character is
substituted by different ciphertext characters
(i.e., polyalphabetic)
Faculty Name: Dr. Amrita 89
Vigenère Cipher
⚫ Easiest way to handle Vigenère cipher is
to use arithmetic modulo 26
⚫ This approach dispenses with the need
for the table
⚫ Keyword is converted to numbers and
corresponding numbers in message and
keyword are added modulo 26

Faculty Name: Dr. Amrita 90


Example of Vigenère Cipher
⚫ write the plaintext out
⚫ write the keyword repeated above it
⚫ encrypt the corresponding plaintext letter
⚫ Keyword: deceptive
key:
deceptivedeceptivedeceptive
plaintext:
wearediscoveredsaveyourself
ciphertext:
ZICVTWQNGRZGVTWAVZHCQYGLMGJ

Faculty Name: Dr. Amrita 91


Security of Vigenère Ciphers
⚫ There are multiple (how many?) ciphertext letters
corresponding to each plaintext letter.
⚫ So, letter frequencies are obscured but not totally
lost.
⚫ To break Vigenere cipher:
1. Try to guess the key length. How?
2. If key length is N, the cipher consists of N
Caesar ciphers. Plaintext letters at positions k,
N+k, 2N+k, 3N+k, etc., are encoded by the same
cipher.
3. Attack each individual cipher as before.
Faculty Name: Dr. Amrita 92
Guessing the Key Length
⚫ Main idea: Plaintext words separated by multiples
of the key length are encoded in the same way.
⚫ In our example, if plaintext = “…thexxxxxxthe…”
then “the” will be encrypted to the same ciphertext
words.
⚫ So look at the ciphertext for repeated patterns.
⚫ E.g. repeated “VTW” in the previous example
suggests a key length of 3 or 9:
ciphertext:
ZICVTWQNGRZGVTWAVZHCQYGLMGJ

⚫ Of course, the repetition could be a random fluke.

Faculty Name: Dr. Amrita 93


One-Time Pad
One of the goals of cryptography is perfect
secrecy. A study by Shannon has shown that
perfect secrecy can be achieved if each plaintext
symbol is encrypted with a key randomly chosen
from a key domain. This idea is used in a cipher
called one-time pad, invented by Vernam.

Faculty Name: Dr. Amrita 94


Vernam / One-Time Pad Cipher
⚫ U.S. Army Major Joseph Mauborgne and
AT&T’s Gilbert Vernam developed a cipher in
1917
⚫ Uses a one time arrangement of a key string
that is as long as the plaintext
⚫ Plaintexts are assumed to be short
⚫ Also known as One-Time Pad cipher
⚫ Key is used only once but characters in key
may not be distinct

Faculty Name: Dr. Amrita 95


Vernam Cipher : Example

⚫ E.g., Plaintext: HELLO


Key: KTBXZ
--------------
Ciphertext : RXMIN (using addition mod 26)
Key: KTBXZ
--------------
Plaintext: HELLO (using subtraction mod 26)

Faculty Name: Dr. Amrita 96


Transposition Ciphers
⚫ classicaltransposition or
permutation ciphers
⚫ hide the message by rearranging the
letter order
⚫ without altering the actual letters used
⚫ can recognise these since have the same
frequency distribution as the original
text

Faculty Name: Dr. Amrita 97


Rail Fence cipher
⚫ write message letters out diagonally over a number
of rows
⚫ then read off cipher row by row
⚫ eg. write message out as:

⚫ Ciphertext
MEMATRHTGPRYETEFETEOAAT
⚫ a rail fence of depth 2.
⚫ This sort of thing would be trivial to cryptanalyze.

Faculty Name: Dr. Amrita 98


Row Transposition Ciphers
⚫ a more complex transposition
⚫ Plaintext is written row by row in a rectangle.
⚫ Ciphertext: write out the columns in an order
specified by a key.
a t t a c k p
Key: 3 4 2 1 5 6 7
o s t p o n e
d u n t i l t
Plaintext:
w o a m x y z
Ciphertext:
TTNAAPTMTSUOAODWCOIXKNLYPETZ
Faculty Name: Dr. Amrita 99
Transpositions (Permutations)
⚫ Letters of plaintext message are
re-arranged

Faculty Name: Dr. Amrita 100


Transpositions (Permutations)

Faculty Name: Dr. Amrita 101


Product Ciphers
⚫ ciphers using substitutions or transpositions
are not secure because of language
characteristics
⚫ hence consider using several ciphers in
succession to make harder, but:
◦ two substitutions make a more complex
substitution
◦ two transpositions make more complex
transposition
◦ but a substitution followed by a transposition
makes a new much harder cipher
⚫ this is bridge from classical to modern ciphers
Faculty Name: Dr. Amrita 102
Product Ciphers
⚫A substitution followed by a
transposition is known as a Product
Cipher
⚫ makes a new much more secure cipher
⚫ Harder to break than just substitutions
or transpositions
⚫ This is a bridge from classical to modern
ciphers.

Faculty Name: Dr. Amrita 103


Rotor Machines
⚫ before modern ciphers, rotor machines were
most common complex ciphers in use
⚫ widely used in WW2
◦ German Enigma, Allied Hagelin, Japanese Purple
⚫ implemented a very complex, varying
substitution cipher
⚫ used a series of cylinders, each giving one
substitution, which rotated and changed after
each letter was encrypted
⚫ with 3 cylinders have 263=17576 alphabets

Faculty Name: Dr. Amrita 104


Hagelin Rotor Machine

Faculty Name: Dr. Amrita 105


Faculty Name: Dr. Amrita 106
Steganography
⚫ an alternative to encryption
⚫ hides existence of message
◦using only a subset of letters/words in a
longer message marked in some way
◦using invisible ink
◦hiding in LSB in graphic image or sound file
⚫ has drawbacks
◦high overhead to hide relatively few info bits

Faculty Name: Dr. Amrita 107


Steganography
⚫ Hiding a message within another medium,
such as an image
⚫ No key is required
⚫ Example
◦ Modify color map of JPEG image

Faculty Name: Dr. Amrita 108


Cryptography vs. Steganography
Cryptography
– “hidden writing”
– concealing the meaning (contents) of a
message but not the message itself
Steganography
– greek: “steganos”, covered
– hide the message (so existence is not known)
– invisible ink, microdots, messages hidden in
pictures, sounds,...

Faculty Name: Dr. Amrita 109

You might also like