CNS Algo

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

Unit-2

Classical Encryption Techniques and Block Ciphers:


Classical Encryption Techniques: Symmetric Cipher Model, Substitution
Techniques: Caesar Cipher, Monoalphabetic Ciphers, Playfair Cipher, Hill
Cipher, Polyalphabetic Ciphers, One-time Pad, Transposition Techniques.
Symmetric Encryption

Symmetric encryption is a form of cryptosystem in which encryption and


decryption are performed using the same key. It is also known as conventional
encryption or single key encryption.

Symmetric encryption transforms plaintext into ciphertext using a secret key and
an encryption algorithm. Using the same key and a decryption algorithm, the
plaintext is recovered from the ciphertext.

The two types of attack on an encryption algorithm are cryptanalysis and brute-
force.

Traditional (precomputer) symmetric ciphers use substitution and/or transposition


techniques.
SYMMETRIC CIPHER MODEL

A symmetric encryption scheme has five ingredients

• Plaintext
• Encryption algorithm
• Secret key
• Ciphertext
• Decryption algorithm
There are two requirements for secure use of conventional encryption:

• We need a strong encryption algorithm.


• Sender and receiver must have obtained copies of the secret key in a
secure fashion and must keep the key secure.
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)
This notation indicates Y is produced by using encryption algorithm E as a function
of the plaintext X with a specific function determined by the value of the key. 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. It is assumed that the opponent knows the encryption (E) and
decryption (D) algorithms. If the opponent is interested in only this particular message,
then the focus of the effort is to recover X by generating a plaintext estimate X^. Often,
however, the opponent is interested in being able to read future messages as well, in
which case an attempt is made to recover K Cryptography by generating an estimate
K^
Cryptography

Cryptographic systems are characterized along three independent dimensions:


1. The type of operations used for transforming plaintext to ciphertext.
All encryption algorithms are based on two general principles: substitution, in
which each element in the plaintext (bit, letter, group of bits or letters) is mapped into
another element, and transposition, in which elements in the plaintext are rearranged.
The fundamental requirement is that no information be lost.

2. 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.
3. 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
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 cipher text until an intelligible
translation into plaintext is obtained. On an average, half of all possible keys must be
tried to achieve success.
Types of Attacks on Encrypted Messages
Average Time Required for Exhaustive Key Search
Substitution Techniques

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.1 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.

plain: 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: 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

Let us assign a numerical equivalent to each letter


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 takes on a value in the range 1 to 25.The decryption algorithm is simply
p = D(k,C) = (C- k) mod 26
Monoalphabetic Cipher
A monoalphabetic substitution is a cipher in which each
occurrence of a plaintext symbol is replaced by a corresponding
ciphertext symbol to generate ciphertext based on the single
alphabetic key
Polyalphabetic Cipher

1. Vigenere Cipher

plaintext letters P = p0,p1, p2,p3………, pn-1


sequence of key letters K = k0,k1, k2,k3……,km-1 where m < n
ciphertext letters C = C0,C1,C2,C3…….,Cn-1.
C = E(K,P) = E[(k0,k1, k2,… , km-1), (p0, p1, p2,… , pn-1)]
C = (p0 + k0)mod 26, (p1 + k1)mod 26,… , (pm-1 + km-1)mod 26, (pm + k0)mod 26,
(pm+1 + k1)mod 26,………… , (p2m-1 + km-1)mod 26, Ci = (pi + kimodm)mod 26
Similarly, decryption pi = (Ci- kimodm)mod 26
Autokey system
VERNAM CIPHER

The ultimate defense against such a cryptanalysis is to choose a keyword that is as


long as the plaintext and has no statistical relationship to it. Such a system was
introduced by an AT&T engineer named Gilbert Vernam in 1918. His system
works on binary data (bits) rather than letters. The system can be expressed
succinctly as follows
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 bot tom, 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. Plaintext is encrypted two letters at a time,
Rules:

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
5. becomes BP and ea becomes IM (or JM, as the encipherer wishes)
One-Time Pad
• Joseph Mauborgne, proposed an improvement to the Vernam cipher that
yields the ultimate in security.
• Mauborgne suggested using a random key that is as long as the message, so
that the key need not be repeated. In addition, the key is to be used to
encrypt and decrypt a single message, and then is discarded.
• Each new message requires a new key of the same length as the new
message. Such a scheme, known as a one-time pad, is unbreakable
• It produces random output that bears no statistical relationship to the
plaintext
• The security of the one-time pad is entirely due to the randomness of the
key.

Two fundamental difficulties


• There is the practical problem of making large quantities of random keys.
• The problem of key distribution and protection.

The one-time pad is the only cryptosystem that exhibits what is referred to as
Transposition Techniques
Its a very different kind of mapping achieved by performing some sort of
permutation on the plaintext letters.
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.
Example:
Plaintext: “meet me after the toga party”
Depth: 2

The encrypted message is


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. For example,

The transposition cipher can be made significantly more secure by performing


more than one stage of transposition Thus, if the foregoing message is reencrypted
using the same algorithm,

You might also like