Chapter III:
CRYPTOGRAPHY
INTRODUCTION
What is Cryptography?
“Hidden Writing”
Mainly used to protect Information.
Goal of Cryptography
Ensure security of communication over insecure
medium
Communicate even with possibility of adversary
Cryptography
Cryptography is the
science and art of
transforming messages
to make them secure
and immune to attack.
What is Cryptography?
Cryptography derived its name from a
Greek word called “Kryptos” which
means “Hidden Secrets”.
Cryptography is the practice and study
of hiding information.
It is the Art or Science of converting a
plain intelligible data into an
unintelligible data and again
retransforming that message into its
original form.
It provides Confidentiality, Integrity,
Accuracy.
NEED OF ENCRYPTION
Confidentiality
Integrity
Authentication
Non repudiation
Access Control
Availability
BASIC TERMS
PLAIN TEXT
CIPHER TEXT
CIPHER
ENCRYPTION & DECRYPTION
KEYS
What is a Key
In cryptography, a key is a variable value that is applied
using an algorithm to a string or block of unencrypted
text to produce encrypted text, or to decrypt encrypted
text. The length of the key is a factor in considering how
difficult it will be to decrypt the text in a given message.
What is Encryption / Decryption
Encryption –
The process of converting plain text into an unintelligible
format (cipher text) is called Encryption.
Decryption –
The process of converting cipher text into a plain text is
called Decryption.
Cryptosystem
A system for encryption and decryption is called a
cryptosystem.
ENCRYPATION & DECRYPTION
Basic Terminologies
Plaintext
Cipher text
Key –
key refers to a sequence of symbols or a numerical value used
by an algorithm to alter information & making that
information secure
Encryption algorithm
The cryptosystem involves a set of rules for how to encrypt
the plaintext and how to decrypt the cipher text.
Cryptanalysis
Cryptanalysis is an attempt to break the cipher text.
TRADITIONAL
CIPHERS
SUBSTITUTION TRANSPOSITION
CIPHER CIPHER
SUBSTITUTION CIPHERS
A substitution technique is one in which
the letters/number/symbols of plaintext are
replaced by other letters/numbers/symbols.
e.g. A D, T Z
2 5, 3 6
TRANSPOSITION CIPHER
In the transposition technique the positions of
letters/numbers/symbols in plaintext is changed with one another.
1 2 3 4 5 6 4 2 1 6 3 5
M E E T M E T E M E E M
A F T E R P E F A P T R
A R T Y Y R A T
Plain text: MEET ME AFTER PARTY
Cipher text: TEMEEMEFAPTRYRAT
KEY USED: 421635
Techniques of Cryptography
Substitution Technique
Caesar Cipher
Monoalphabetic Cipher
Polyalphabetic Cipher
Transposition Technique
Rail Fence Technique
Vernam Cipher(One -time Pads)
Simple Columnar Cipher
Caesar cipher
The Caesar cipher, also known as a shift cipher, is
one of the simplest forms of encryption. It is a
substitution cipher where each letter in the original
message (called the plaintext) is replaced with a letter
corresponding to a certain number of letters up or
down in the alphabet.
In this way, a message that initially was quite readable,
ends up in a form that can not be understood at a
simple glance.
Caesar cipher example
Plaintext: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
Ciphertext: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD
Caesar cipher example
Monoalphabetic and Polyalphabetic Cipher
Monoalphabetic cipher is a substitution cipher in which for
a given key, the cipher alphabet for each plain alphabet is
fixed throughout the encryption process.
For example, if ‘A’ is encrypted as ‘D’, for any number of
occurrence in that plaintext, ‘A’ will always get encrypted to
‘D’.
All of the above substitution ciphers are monoalphabetic;
these ciphers are highly susceptible to cryptanalysis.
Polyalphabetic Cipher is a substitution cipher in which the
cipher alphabet for the plain alphabet may be different at
different places during the encryption process.
The next two examples, playfair and Vigenere Cipher are
polyalphabetic ciphers.
Playfair Cipher
In this scheme, pairs of letters are encrypted, instead
of single letters as in the case of simple substitution
cipher.
In playfair cipher, initially a key table is created. The
key table is a 5×5 grid of alphabets that acts as the key
for encrypting the plaintext.
Each of the 25 alphabets must be unique and one
letter of the alphabet (usually J) is omitted from the
table as we need only 25 alphabets instead of 26. If the
plaintext contains J, then it is replaced by I.
Playfair Cipher
The sender and the receiver deicide on a particular
key, say ‘tutorials’. In a key table, the first characters
(going left to right) in the table is the phrase,
excluding the duplicate letters. The rest of the table
will be filled with the remaining letters of the
alphabet, in natural order. The key table works out to
be −
Process of Playfair Cipher
First, a plaintext message is split into pairs of two
letters (digraphs). If there is an odd number of letters,
a Z is added to the last letter. Let us say we want to
encrypt the message “hide money”. It will be written as
−
HI DE MO NE YZ
Playfair Cipher
The rules of encryption are −
If both the letters are in the same column, take the
letter below each one (going back to the top if at the
bottom)
Playfair Cipher
If both letters are in the same row, take the letter to
the right of each one (going back to the left if at the
farthest right)
Playfair Cipher
If neither of the preceding two rules are true, form a
rectangle with the two letters and take the letters on
the horizontal opposite corner of the rectangle.
Playfair Cipher
Using these rules, the result of the encryption of ‘hide
money’ with the key of ‘tutorials’ would be −
QC EF NU MF ZV
Decrypting the Playfair cipher is as simple as doing
the same process in reverse. Receiver has the same key
and can create the same key table, and then decrypt
any messages made using that key.
Vigenere Cipher
This scheme of cipher uses a text string (say, a word)
as a key, which is then used for doing a number of
shifts on the plaintext.
For example, let’s assume the key is ‘point’. Each
alphabet of the key is converted to its respective
numeric value: In this case,
p → 16, o → 15, i → 9, n → 14, and t → 20.
Thus, the key is: 16 15 9 14 20.
Process of Vigenere Cipher
The sender and the receiver decide on a key. Say ‘point’
is the key. Numeric representation of this key is ‘16 15 9
14 20’.
The sender wants to encrypt the message, say ‘attack
from south east’. He will arrange plaintext and numeric
key as follows −
Vigenere Cipher
He now shifts each plaintext alphabet by the number
written below it to create ciphertext as shown below −
Vigenere Cipher
Here, each plaintext character has been shifted by a
different amount – and that amount is determined by
the key. The key must be less than or equal to the size
of the message.
For decryption, the receiver uses the same key and
shifts received ciphertext in reverse order to obtain the
plaintext.
Security Value
Vigenere Cipher was designed by tweaking the
standard Caesar cipher to reduce the effectiveness of
cryptanalysis on the ciphertext and make a
cryptosystem more robust.
It is significantly more secure than a regular Caesar
Cipher.
In the history, it was regularly used for protecting
sensitive political and military information. It was
referred to as the unbreakable cipher due to the
difficulty it posed to the cryptanalysis.
Variants of Vigenere Cipher
The keyword length is same as plaintext message. This
case is called Vernam Cipher. It is more secure than
typical Vigenere cipher.
Vigenere cipher becomes a cryptosystem with perfect
secrecy, which is called One-time pad.
One-Time Pad
The circumstances are −
The length of the keyword is same as the length of the
plaintext.
The keyword is a randomly generated string of
alphabets.
The keyword is used only once.
Security Value
Let us compare Shift cipher with one-time pad.
TRANSPOSITION TECHNIQUES
Transposition Cipher is cryptographic method by
moving letters or elements around rather than
replacing them with some other elements
Plain Text
MEET ME TOMORROW
Encryption
TEEM EM WORROMOT
Decryption
MEET ME TOMORROW
Transposition Cipher
It is another type of cipher where the order of
the alphabets in the plaintext is rearranged to
create the cipher text. The actual plaintext
alphabets are not replaced.
An example is a ‘simple columnar
transposition’ cipher where the plaintext is
written horizontally with a certain alphabet
width. Then the cipher text is read vertically as
shown.
For example, the plaintext is “golden statue is
in eleventh cave” and the secret random key
chosen is “no of column =5 “We arrange this
text horizontally in table with number of
column equal to key value. The resulting text is
shown below.
Transposition Cipher
The ciphertext is obtained by reading column vertically
downward from first to last column. The ciphertext is
‘gnuneaoseenvltiltedasehetivc’.
To decrypt, the receiver prepares similar table. The
number of columns is equal to key number. The number of
rows is obtained by dividing number of total ciphertext
alphabets by key value and rounding of the quotient to
next integer value.
The receiver then writes the received ciphertext vertically
down and from left to right column. To obtain the text, he
reads horizontally left to right and from top to bottom row.
Rail
Fence Cipher
The Rail Fence cipher is a form of transposition cipher
that gets its name from the way in which it is encoded.
In the rail fence cipher, the plaintext is written
downwards on successive "rails" of an imaginary fence
The message is then read off in rows. For example,
using three "rails" and a message of 'WE ARE
DISCOVERED. FLEE AT ONCE', the cipherer writes
out:
Rail Fence Cipher
The rail fence cipher was used by the ancient Greeks in
the scytale, a mechanical system of producing a
transposition cipher.
The system consisted of a cylinder and a ribbon that was
wrapped around the cylinder. The message to be
encrypted was written on the coiled ribbon.
The letters of the original message would be rearranged
when the ribbon was uncoiled from the cylinder.
However, the message was easily decrypted when the
ribbon was recoiled on a cylinder of the same diameter as
the encrypting cylinder.[1]
Columnar transposition
In a columnar transposition, the message is written out in rows of a
fixed length, and then read out again column by column, and the
columns are chosen in some scrambled order.
Both the width of the rows and the permutation of the columns are
usually defined by a keyword. For example, the keyword ZEBRAS is
of length 6 (so the rows are of length 6), and the permutation is
defined by the alphabetical order of the letters in the keyword.
In this case, the order would be "6 3 2 4 1 5".
In a regular columnar transposition cipher, any spare spaces are
filled with nulls; in an irregular columnar transposition cipher, the
spaces are left blank.
Finally, the message is read off in columns, in the order specified by
the keyword.
For example, suppose we use the keyword ZEBRAS and the
message WE ARE DISCOVERED. FLEE AT ONCE. In a regular
columnar transposition, we write this into the grid as follows:
Columnar transposition
providing five nulls (QKJEU), these letters can be
randomly selected as they just fill out the incomplete
columns and are not part of the message. The
ciphertext is then read off as:
Columnar transposition
In the irregular case, the columns are not completed by
nulls:
Columnar transposition
To decipher it, the recipient has to work out the
column lengths by dividing the message length by the
key length.
Then he can write the message out in columns again,
then re-order the columns by reforming the key word.
In a variation, the message is blocked into segments
that are the key length long and to each segment the
same permutation (given by the key) is applied.
This is equivalent to a columnar transposition where
the read-out is by rows instead of columns.
Double transposition
During World War I, the German military used a
double columnar transposition cipher, changing the
keys infrequently.
The system was regularly solved by the French,
naming it Übchi, who were typically able to quickly
find the keys once they'd intercepted a number of
messages of the same length, which generally took
only a few days.
Transposition Cipher