What is aSymmetric Key?
• Cryptography
An original message is known as the plaintext.
The Coded message is called the cipher text.
• In cryptography, a symmetric key is one that is used both to
encrypt and decrypt information.
• This means that to decrypt information, one must have the same
key that was used to encrypt it.
3.
Classical Encryption Techniques
•Stream Ciphers
• A stream cipher is an encryption technique that works byte by
byte to transform plain text into code that's unreadable to
anyone without the proper key.
• Stream ciphers are linear, so the same key both encrypts and
decrypts messages. And while cracking them can be difficult,
hackers have managed to do it.
4.
SUBSTITUTION TECHNIQUES
• Asubstitution 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 cipher text bit
patterns.
5.
(1)Caesar cipher (or)shift cipher
The encryption rule is simple; replace each letter of the alphabet
with the letter standing 3 places further down the alphabet.
• The alphabet is wrapped around so that Z follows A.
• Generally Plain text is in lower case and Cipher text is Upper
Case.
• Example:
• Plaintext: meet me after the party
• Ciphertext: PHHW PH DIWHU WKH SDUWB
6.
• Here, thekey is 3. If different key is used, different substitution will
be obtained.
• Mathematically, starting from a=0, b=1 and so on, Caesar cipher
can be written as:
• E( ) = ( + ) mod (26)
𝑝 𝑝 𝑘
• D(C) = (C – ) mod (26)
𝑘
This cipher can be broken
o If we know one plaintext-cipher text pair since the difference will be
same.
o By applying Brute Force attack as there are only 26 possible keys.
7.
(2) Monoalphabetic SubstitutionCipher
• Instead of shifting alphabets by fixed amount as in Caesar cipher, any
random permutation is assigned to the alphabets. This type of encryption
is called monoalphabetic substitution cipher.
• For example, A is replaced by Q, B by D, C by T etc. then it will be
comparatively stronger than Caesar cipher.
• The number of alternative keys possible now becomes 26!.
• Thus, Brute Force attack is impractical in this case.
• However, another attack is possible. Human languages are redundant
i.e. certain characters are used more frequently than others. This fact can
be exploited.
• In English ‘e’ is the most common letter followed by ‘t’, ‘r’, ‘n’, ’o’,
‘a’ etc. Letters like ‘q’, ‘x’, ‘j’ are less frequently used.
8.
• Moreover, digramslike ‘th’ and trigrams like ‘the’ are also more
frequent.
• Tables of frequency of these letters exist. These can be used to
guess the plaintext if the plaintext is in uncompressed English
language.
• The most common two letter combinations are called as digrams.
e.g. th, in, er, re and an.
• The most common three letter combinations are called as
trigrams. e.g. the, ing, and, and ion
9.
(3) Playfair Cipher
•In this technique multiple (2) letters are encrypted at a time.
• This technique uses a 5 X 5 matrix which is also called key
matrix.
10.
• The plaintextis encrypted two letters at a time:
Break the plaintext into pairs of two consecutive letters.
If a pair is a repeated letter, insert a filler like ‘X‘ in the plaintext, eg.
"Balloon" is treated as "ba lx lo on".
If both letters fall in the same row of the key matrix, replace each
with the letter to its right (wrapping back to start from end), eg. “AR"
encrypts as "RM".
If both letters fall in the same column, replace each with the letter
below it (again wrapping to top from bottom), eg. “MU" encrypts to
"CM".
Otherwise each letter is replaced by the one in its row in the column
of the other letter of the pair, eg. “HS" encrypts to "BP", and “EA" to
"IM" or "JM" (as desired)
11.
• Security ismuch improved over monoalphabetic as here two letters
are encrypted at a time and hence there are 26 X 26 =676 diagrams
and hence it needs a 676 entry frequency table.
• Example 2:
Plaintext: "instruments" keyword: monarchy
After Split: 'in' 'st' 'ru' 'me' 'nt' 'sz'
For both encryption and decryption, the same key is to be used.
The Playfair CipherDecryption Algorithm:
• Generate the key Square(5×5) at the receiver’s end:
• Algorithm to decrypt the ciphertext: The ciphertext is
split into pairs of two letters (digraphs).
• Note: The ciphertext always have even number of
characters.
• Cipher Text: "gatlmzclrqtx"
• After Split: 'ga' 'tl' 'mz' 'cl' 'rq' 'tx‘
Rules for Decryption:
If both the letters are in the same column: Take the
letter above each one (going back to the bottom if at the
top).
• If boththe letters are in the same row: Take the letter to the
left of each one (going back to the rightmost if at the leftmost
position).
• Diagraph: "tl"
• Decrypted Text: st
16.
• If neitherof 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: "rq"
• Decrypted Text: nt
18.
(4) Hill Cipher
•In the pretext of classical cryptography, Hill Cipher represents a
polygraphic substitution cipher that follows a uniform
substitution across multiple levels of blocks.
• It was the first polygraphic cipher in which it was practical to
operate on more than three symbols at once.
• Encryption:
• C = K P mod 26 ………….(15).
• Decryption:
• P = −
𝐊 𝟏C mod 26 …………(16).
19.
(4) Hill Cipher
•Hill Cipher Encryption
L
e
tt
e
r
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
N
u
m
b
e
r
0 1 2 3 4 5 6 7 8 9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
20.
• We haveto encrypt the message ‘ACT’ (n=3).The key is
‘GYBNQKURP’ which can be written as the nxn matrix:
The message ‘ACT’ is written as vector:
(5)Poly Alphabetic Cipher
•In a polyalphabetic cipher, multiple “alphabets” are used
to encipher.
• If two letters are the same in the cipher text it does not
mean they must decipher to the same plaintext letter.
B. Vernam Cipher
•Vernam Cipher is a method of encrypting alphabetic text. It is
one of the Substitution techniques for converting plain text into
cipher text. In this mechanism we assign a number to each
character of the Plain-Text, like (a = 0, b = 1, c = 2, … z = 25).
• Method to take key: In the Vernam cipher algorithm, we take a
key to encrypt the plain text whose length should be equal to
the length of the plain text.
• Encryption Algorithm:
• Assign a number to each character of the plain-text and the key
according to alphabetical order.
• Bitwise XOR both the number (Corresponding plain-text
character number and Key character number).
• Subtract the number from 26 if the resulting number is greater
than or equal to 26, if it isn’t then leave it.
31.
• Plain-Text: OA K Key: S O N
• O ==> 14 = 0 1 1 1 0
• S ==> 18 = 1 0 0 1 0
• Bitwise XOR Result: 1 1 1 0 0 = 28
• Since the resulting number is greater than 26, subtract 26
from it. Then convert the Cipher-Text character number to
the Cipher-Text character.
• 28 - 26 = 2 ==> C
• CIPHER-TEXT: C
• CT-NO: 02 14 07
• CT: C O H
32.
• 𝐶i =i I
𝑃 ⊕ 𝐾
• Decryption simply involves the same bitwise operation:
• 𝑃i = i i
𝐶 ⊕ 𝐾
33.
C. One-Time Pad
• In this scheme, a random key that is as long as the
message is used.
• The key is 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.
• This scheme is unbreakable.
• It produces random output that bears no statistical
relationship to the plaintext.
• Because the ciphertext contains no information
whatsoever about the plaintext, there is simply no way to
break the code.
34.
Transposition Techniques
• Avery 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.
• It rearranges the characters in the plain text to form the cipher text.The
letter are not changed.
Transposition Techniques
• Rail Fence Transposition
• Columnar Transposition
• Improved Columnar Transposition
• Book Cipher/Running Key Cipher
The simplest such cipher is the rail fence technique.
35.
1. Rail FenceCipher
• Step 1: The plain text is written as a sequence of diagonals.
• Step 2: Then, to obtain the cipher text the text is read as a
sequence of rows.
• Plain Text: meet me Tomorrow
• Now, we will write this plain text sequence wise in a diagonal
form as you can see below:
36.
• Once youhave written the message as a sequence of diagonals,
to obtain the cipher text out of it you have to read it as a
sequence of rows.
• So, reading the first row the first half of cipher text will be:
m e m t m r o
• reading the second row of the rail fence, we will get the
second half of the cipher text:
e t e o o r w
• Now, to obtain the complete cipher text combine both the
halves of cipher text and the complete cipher text will be:
• Cipher Text: M E M T M R O E T E O O R W
37.
2. Columnar TranspositionTechnique
• Step 1: The plain text is written in the rectangular matrix of the
initially defined size in a row by row pattern.
• Step 2: To obtain the cipher text read the text written in a
rectangular matrix column by column. But you have to permute
the order of column before reading it column by column. The
obtained message is the cipher text message.
• Plain text: meet Tomorrow
• Now, put the plain text in the rectangle of a predefined size. For
our example, the predefined size of the rectangle would be 3×4.
As you can see in the image below the plain text is placed in the
rectangle of 3×4. And we have also permuted the order of the
column.
38.
Now, to obtainthe cipher text we have to read the plain text column
by column as the sequence of permuted column order. So, the
cipher text obtained by the columnar transposition technique in this
example is:
Cipher Text: MTREOREMOTOW.
39.
3. Columnar TranspositionTechnique with Multiple
Rounds
• The basic columnar technique is performed over the plain text
but more than once.
• Cipher Text round 1: MTREOREMOTOW
• Now, again we have to put the cipher text of round 1 in the rectangle
of size 3×4 row by row and permute the order of columns before
reading the cipher text for round 2. In the second round, the
permuted order of the column is 2, 3, 1, 4.
• So, the obtained cipher text for round 2 is MOOTRTREOEMW. In
this way, we can perform as many iterations as requires. Increasing
the number of iterations increases the complexity of the techniques.
40.
4. Book Cipheror Running Key Cipher
• The book cipher or the running key cipher works on the basic
principle of one-time pad cipher. In onetime pad cipher the key is
taken as long as the plain text and is discarded after the use. Every
time a new key is taken for a new message.
• Step 1: Convert the plain text in numeric form consider A=0,
B=1, C=3 …, Z=25.
• Step 2: Take an onetime pad or key from any of the books
and convert it in the numeric form also. But the key must be
as long as the length of plain text.
• Step 3: Now add the numeric form of both plain text and
key, each plain text letter with corresponding key text letter.
If the addition of any plain text letter with corresponding key
text letter is >26, then subtract it with 26.
41.
Let us understandwith the example:
• Plain text: Meet Tomorrow
• Key taken from the book: ANENCRYPTION.
• Now we have to convert this plain text and key text in numeric
form and add them to get cipher text as shown in the image
below:
42.
Differentiate between linearand differential
cryptanalytic
Linear Cryptanalysis Differential Cryptanalysis
Linear cryptanalysis
first defined by Matsui and Yamagishi
in 1992.
Differential cryptanalysis is a method for breaking
certain classes of cryptosystems is invented in
1990 by Israeli researchers Eli Biham and Adi
Shamir.
In linear cryptanalysis, the role of the cryptanalyst
is to identify the linear relation between some bits
of the plaintext, some bits of the ciphertext, and
some bits of the unknown key.
Differential cryptanalysis is available to obtain
clues about some bits of the key, thereby
shortening an exhaustive search
The cryptanalyst decrypts each ciphertext using
all possible subkeys for one round of encryption
and studies the resulting intermediate ciphertext
to analyze the random result.
Cryptanalyst studies changes to the intermediate
ciphertext obtained between multiple rounds of
encryption. The attacks can be combined, which
is called differential linear cryptanalysis.
In linear cryptanalysis, the role of the cryptanalyst
is to identify the linear relation between some bits
of the plaintext, some bits of the ciphertext, and
some bits of the unknown key
By analyzing the changes in some chosen
plaintexts, and the difference in the outputs
resulting from encrypting each one, it is possible
to recover some of the keys.
Linear cryptanalysis focus on statistical analysis
against one round of decrypted ciphertext
Differential analysis focuses on the statistical
analysis of two inputs and two outputs of a
cryptographic algorithm.
43.
Differentiate stream andblock cipher?
Key Block Cipher Stream Cipher
Definition
Block Cipher is the type of encryption where
the conversion of plaintext is performed by
taking its block at a time.
Stream Cipher is the type of encryption
where the conversion of plaintext is
performed by taking one byte of the plaintext
at a time.
Conversion of Bits
Since Block Cipher converts blocks at a
time, it converts a more significant number
of bits than Stream Cipher, which can
convert 64 bits or more.
In the case of Stream Cipher, however, only
8 bits can be transformed at a time.
Principle
Block Cipher uses both "confusion" and
"diffusion" principle for the conversion
required for encryption.
Stream Cipher uses only confusion principle
for the conversion.
Algorithm
For encryption of plain text Block Cipher
uses Electronic Code Book (ECB) and
Cipher Block Chaining (CBC) algorithm.
Stream Cipher uses CFB (Cipher Feedback)
and OFB (Output Feedback) algorithm.
Decryption
As a combination of more bits get encrypted
in case of Block Cipher, so the reverse
encryption or decryption is comparatively
complex as compared to that of Stream
Cipher.
Stream Cipher uses XOR for the encryption
which can be easily reversed to the plain text.
Implementation
Feistel Cipher is the most common Block
Cipher implementation.
The main implementation of Stream Cipher
is Vernam Cipher.
44.
Differentiate between substitutionand transposition
cipher?
BASIS FOR COMPARISON
SUBSTITUTION TECHNIQUE TRANSPOSITION TECHNIQUE
Basic Replaces the plaintext characters with
other characters, numbers and
symbols.
Rearranges the position of the
characters of the plaintext.
Forms Monoalphabetic and polyalphabetic
substitution cipher.
Keyless and keyed transpositional
cipher.
Alterations The identity of the character is
changed while its position remains
unchanged.
The position of the character is
changed in spite of its identity.
Demerit The letter with the low frequency can
discern the plaintext.
Keys near to the correct key can
disclose the plaintext.
Example Caesar Cipher Reil Fence Cipher
45.
Differentiate between Diffusionand Confusion?
Features Confusion Diffusion
Definition It is a cryptography technique utilized to
create vague ciphertext.
It is employed to generate cryptic plain
texts.
Achieved through It is achieved via the substitution technique. It is achieved via the transposition
technique.
Seeks to The relationship between the ciphertext
statistics and the encryption key value is
complicated.
The plain text's statistical structure is
dispersed into the ciphertext's long-range
statistics.
Used by It utilizes only block cipher. It utilizes both stream and block cipher.
Modifications If one bit in secret is changed, most bits in
the cipher text will be changed.
If one image within the plain text changes,
most images within the cipher text will also
change.
Resultant Vagueness is increased Redundancy is increased
Relations It conceals the relation between the key and
the ciphertext.
It conceals the relation between the
plaintext and the ciphertext.
46.
Differentiate AES andDES Algorithm?
AES DES
1. AES stands for
Advanced Encryption Standard
DES stands for
Data Encryption Standard
2. The date of creation is 2001. The date of creation is 1977.
3. Byte-Oriented. Bit-Oriented.
4. Key length can be 128-bits, 192-bits,
and 256-bits.
The key length is 56 bits in DES.
5.
Number of rounds depends on key
length: 10(128-bits), 12(192-bits), or
14(256-bits)
DES involves 16 rounds of identical
operations
6. The structure is based on a substitution-
permutation network.
The structure is based on a Feistel
network.
7. The design rationale for AES is open. The design rationale for DES is closed.
8. The selection process for this is secret
but accepted for open public comment.
The selection process for this is secret.