Chapter01 Part 02 Updated
Chapter01 Part 02 Updated
• X = plaintext
• Y = ciphertext
• K = secret key
• E = encryption algorithm
• D = decryption algorithm
• Both E and D are known to
public
Cryptography
Cryptographic systems are characterized along three independent dimensions:
DK(decryption rule).
Each EK: P->C and DK: C->P are functions
such that , DK(EK(x)) = x.
The two basic building blocks of all encryption techniques are :
1. Substitution techniques: 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.
Different types of Substitution techniques are:
1. Caesar Cipher
2. Monoalphabetic Ciphers
3. Playfair Cipher
4. Hill Cipher
5. Polyalphabetic Ciphers
6. One-Time Pad
Caesar Cipher
The Caesar Cipher technique is one of the earliest and simplest method of
encryption technique. It’s simply a type of substitution cipher, i.e., each letter
of a given text is replaced by a letter some fixed number of positions down
the alphabet. The method is apparently named after Julius Caesar, who
apparently used it to communicate with his officials.
Example, key=3
plaintext: hello how are you
ciphertext: KHOOR KRZ DUH BRX
Caesar Cipher
can define transformation as:
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
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
a b c d e f g h i j kgive
l meach letter a
number
0 1 2 3 4 5
n o p q
6 7 8 9 10 11 12
r s t u v w x y
13 14 15 16 17 18 19 20 21 22 23Z 24 25
• 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. If two letters considered for substitutes it is called as digrams.
•For Example: A-
Plaintext: goodmorning
Ciphertext:
TLLWNLIMRMT
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
(monarchy)
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
S E C U R
I/J T Y A B
D F G H K Plaintext is encrypted two letters at a time, according
L M N O P to the following rules: BALLOON=> BA LX L0 ON
Q V W X Z
1) Repeating plaintext letters that are in the same pair are separated with a filler
letter, such as x, so that pattern would be treated as pa tx te rn.
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.
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, 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 VA FT CP
For one thing, whereas there are only 26 letters, there are 26 * 26 = 676
diagrams, so that identification of individual diagrams is more difficult.
Hill Cipher
• This encryption algorithm takes m successive plaintext letters and substitutes
for them m ciphertext letters.
• The substitution is determined by m linear equations in which each character
is assigned a numerical value.
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
1 2
2
Plaintext: abcd
Keyword: 35 1
𝑘−1 3 −1
2 −1 5 3
=
P=D(C,K)=C𝐾−1mod2
=
6 5 𝑎c − 𝑏𝑑 5
C=E(P,K)=PKmod26
1 3 1 2 2
0 −1 mod26
C= 2 mod26 21 8 5
3 5 2
P=
3
0
5 2
P= 1
C=
21 mod26 2 3
0
mod26
P= 2 1
C=
8
5
C=fcvi 3
P=abcd
Polyalphabetic Ciphers
• Another way to improve on the simple monoalphabetic technique is to use different
monoalphabetic substitutions as one proceeds through the plaintext message.
• The general name for this approach is polyalphabetic substitution cipher.
• All these techniques have the following features in common:
𝑃𝑖ሶ
𝐶𝑖 − 𝑘𝑖
plaintext: wearediscoveredsaveyourself
=
ciphertext: ZICVTWQNGKZEIIGASXSTSLVVWLA mod26
mod 𝑚
One-Time Pad (Vernam cipher)
ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
key: pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih
plaintext: mr mustard with the candlestick in the hall
ciphertext:
ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYT
S
key: mfugpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwt
plaintext: miss scarlet with the knife in the library
• In theory, we need look no further for a cipher. The one-time pad
offers complete security but, in practice, has two fundamental difficulties:
1.There is the practical problem of making large
quantities of random heavilykeys. usedAnysystem might millions
of random characters on a regular require basis.
characters in this volume is a significant task.
Supplying truly random
2.Even more daunting is the problem of key distribution and
protection. For every message to be sent, a key
is needed by both sender and receiver. Thus, a mammoth
distribution problem
key exists. of
• Because of these difficulties, the one-time pad is of limited utility and
is useful primarily for low-bandwidth channels requiringequal
very high security.
• The one-time pad is the only cryptosystem that exhibits what is referred to as
perfect secrecy. length
Transposition Techniques
A very different kind of mapping is achieved by performing 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,
Plaintext: meet me after the toga party
rail fence of depth: 2
mematrhtgpry
etefeteoaat
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.
Key: 4312567
Plaintext: a t t a c k p
os t ponE
dun t I l T
wo amx y z
Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
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 reencrypted
using the same algorithm,
Key: 4312567
Plaintext t t n a a p t
: mt s uo a o
dwc o i x k
n l ype t z
Output: NSCYAUOPTTWLTMDNAOIEPAXTTOKZ
• To visualize the result of this double 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,
01 02 03 04 05 06 07 08 09 10 11 12 13 14
15 16 17 18 19 20 21 22 23 24 25 26 27 28
• After the first transposition we have,
03 10 17 24 04 11 18 25 02 09 16 23 01 08
15 22 05 12 19 26 06 13 20 27 07 14 21 28
• which has a somewhat regular structure. But after the second transposition,
we have,
17 09 05 27 24 16 12 07 10 02 22 20 03 25
15 13 04 23 19 14 11 01 26 21 18 08 06 28
• This is a much less structured permutation and is much more difficult to
cryptanalyze.
Steganograph
y
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.
Various other techniques have been used historically; some examples are the
following :
Character marking: Selected letters of printed or typewritten text are
overwritten in pencil. The marks are ordinarily not visible unless the paper is
held at an angle to bright light.
Invisible ink: A number of substances can be used for writing but leave no
visible trace until heat or some chemical is applied to the paper.
Pin punctures: Small pin punctures on selected letters are ordinarily not
visible unless the paper is held up in front of a light.
Typewriter correction ribbon: Used between lines typed with a black ribbon,
the results of typing with the correction tape are visible only under a strong
light.
THANK YOU