0% found this document useful (0 votes)
12 views42 pages

CH 2 (YAH)

The document provides an overview of cryptography, cryptanalysis, and cryptology, detailing various encryption techniques including symmetric and asymmetric key encryption, substitution and transposition techniques, and steganography. It explains specific ciphers such as Caesar, Playfair, Hill, and One Time Pad, along with their advantages and disadvantages. Additionally, it includes practical exercises for applying these concepts to find cipher texts from given plain texts and keys.

Uploaded by

anjalirjoshi2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views42 pages

CH 2 (YAH)

The document provides an overview of cryptography, cryptanalysis, and cryptology, detailing various encryption techniques including symmetric and asymmetric key encryption, substitution and transposition techniques, and steganography. It explains specific ciphers such as Caesar, Playfair, Hill, and One Time Pad, along with their advantages and disadvantages. Additionally, it includes practical exercises for applying these concepts to find cipher texts from given plain texts and keys.

Uploaded by

anjalirjoshi2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Prepared By:

Y.A.Hathaliya
Lecturer in Computer Engg. Department
A.V.P.T.I, Rajkot
Topics to be Covered
• Introduction
• Cryptography
• Cryptanalysis
• Cryptology
• Plain Text and Cipher Text
• Encryption and Decryption.
• Substitution Techniques
• Monoalphabetic Cipher : Caesar Cipher
• Polyalphabetic Cipher :Playfair Cipher ,Hill Cipher, One Time Pad Cipher
• Transposition Techniques
• Rail fence
• Steganography
• Introduction
• Types of Steganography Techniques
• Symmetric Cryptography
• Data Encryption Standard- Structure
• Advantages and Disadvantages of DES
Cryptography
The area of study containing the principles and methods of transforming an
intelligible message into one that is unintelligible, and then retransforming
that message back to its original form.
Cryptanalysis
Cryptanalysis is art and science of decoding non readable data without
knowing techniques of encoding.
Cryptanalyst
Person who performs cryptanalysis is known as Cryptanalyst.
Cryptology
Cryptology is a field of study that encompasses both cryptography and
cryptanalysis.
It involves the science and techniques of securing communication and data
from unauthorized access or manipulation.
Symmetric Key Encryption
• Symmetric Key Encryption also referred to as Conventional Encryption
or Single-Key Encryption, In this one key is used for both encryption
and decryption.
• A symmetric encryption system has the following components:
• Plain Text (PT)
• This is the original intelligible message or data that is fed into the
algorithm as input.
• Encryption Algorithm
• The encryption algorithm performs various substitutions and
transformations operations on plaintext.
• It takes in Plain Text and Key as a input and produce the Cipher
Text.
• Secret Key
• The Secret key is also input to the encryption algorithm.
• The key is a value independent of the plaintext and of the
algorithm.
• Cipher Text (CT)
• This is the unintelligible message produced as output.
• It depends on the plaintext and the secret key.
• Decryption Algorithm
• This is essentially the encryption algorithm run in reverse.
• It takes the Cipher Text and the Secret Key as a input and Produces
the original Plain Text.
• Two basic requirements of encryption are:
1) Encryption algorithm should be strong.
2) The key shared by the sender and the receiver should be secret.

• Let us assume X as Plain Text , K as key and Y as Cipher Text Produced,


Then we can write
Y = E(K, X)
; Here E represents the Encryption Algorithm and is a Function of
Plain Text X and key K.

• The Receiver at the other ends Decrypts the Cipher Text using the key.
X=D(K,Y)
;Here D Represents the Decryption Algorithm and it inverts the
transformations of Encryption Algorithm.
Asymmetric Key Encryption
• Asymmetric Key Encryption also referred to as Public Key Encryption, It
uses two keys one is public key that is known by all and other is private
key.
• Asymmetric encryption system has the following components:
• Plain Text (PT)
• This is the original intelligible message or data that is fed into the
algorithm as input.
• Encryption Algorithm
• The Encryption Algorithm Performs various substitutions and
transformations operation on plaintext.
• It takes in Plain Text and key as a input and Produce the Cipher Text.
• Public and Private Key
• This is a pair of keys that have been selected so that if one is used
for encryption, the other is used for decryption.
• Cipher Text (CT)
• This is the unintelligible message produced as output and It
depends on the plaintext and the key.
• Decryption Algorithm
• This is essentially the Encryption Algorithm run in reverse.
• It takes the Cipher Text and the key as a input and produces the
original Plain Text.
• Steps:
– Each user generates a pair of keys to be used for the encryption and
decryption of messages.
– Each user places one of the two keys in a public register or other
accessible file, This is the public key. The other key is kept private.
– If A wishes to send a confidential message to B, A encrypts the
message using B’s public key.
– When B receives the message, it decrypts it using the private key. No
other recipient can decrypt the message because only B knows B’s
private key.
– As long as a user’s private key remains protected and secret, incoming
communication is secure.
• Suppose there is some source A that produces a message in Plain Text,
X and sends it to B.
• B generates a related Pair of Keys: A Public Key, PUb, and a Private Key,
PRb, PUb is publicly available and therefore accessible by A.
• With the message X and the Encryption key PUb as input, A forms the
cipher text Y:
Y = E(PUb, X)
• The intended receiver, having the matching Private Key, is able to
Decrypt the message:
X = D(PRb, Y)
Substitution Technique (Encryption Algorithm)
• Substitution Technique:
– A Substitution Technique is one in which the letters of Plain Text are replaced by
other letters or by numbers or symbols.
– Monoalphabetic Cipher
• A monoalphabetic cipher is any cipher in which the letters of the plain text are
mapped to cipher text letters based on a single alphabetic key.
• The encryption process relies on a one-to-one mapping of characters, meaning
that the same letter in the plaintext is always substituted with the same letter in
the cipher text.
• Example:
– Ceaser Cipher
– Polyalphabetic Cipher
• A polyalphabetic cipher is a type of substitution cipher where each letter in the
plaintext can have multiple corresponding ciphertext letters, depending on its
position in the message.
• The encryption process relies on a one-to-many mapping of characters, meaning
that the same letter in the plaintext substituted with the many letter in cipher
text.
• Example:
– Playfair Cipher
– Hill Cipher
– One Time Pad Cipher (Vermin Cipher)
Caesar Cipher (Shift Cipher)
• In this cipher, Each letter in the Plaintext is replaced by a letter some fixed
number position (Key) down the alphabet.

• For Example with shift 3 A would be replaced by D & The alphabet is wrapped
around so that Z follows A.
• Example:
Plaintext: COMPUTER
Ciphertext: FRPSXWHU
• Here, the key 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(P) = (P+ K) Mod 26
D(C) = (C – k) Mod 26
• Advantages of Ceaser Cipher:
• Simplicity: Easy to understand and implement
• Speed: Fast encryption and decryption
• Educational Use: Useful for teaching basic cryptography
• Disadvantages of Ceaser Cipher:
• Highly insecure, Susceptible to brute-force attacks.
• Frequency Analysis: Vulnerable to analysis based on letter
frequencies.
• Limited Key Space: Small number of possible keys.
• Not Suitable for Real-world Applications
Do It Your Self
• Find out the Cipher Text using following Plain Text and keys.
1. PT = avpti KEY = 4
2. PT = computerdepartment KEY = 5
3. PT = digitalindia KEY = 6
4. PT = rajkot KEY = 6
5. PT = yagnikhathaliya KEY = 4
Playfair Cipher
• This Technique uses a 5 X 5 matrix which is also called Playfair Key Matrix,
also in this Technique Multiple (2) Letters are Encrypted at a time.
• Example: Here the keyword is MONARCHY, the matrix is filled up by the
letters of the key as shown in figure; and then fill up the remaining box by
remaining letters.
• The Plain Text is Encrypted Two Letters at a Time, Steps are
1. Break the Plain Text into pairs of two consecutive letters.
2. If a pair is a repeated letter, insert a filler like ‘X‘in the plaintext, eg.
"balloon" is treated as "ba lx lo on“
3. If in the last there is only one letter then insert X after it to make a
pair.
4. 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“
5. 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“
6. 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)
• In our example If the plain text is YAGNIK then Cipher text is BNQYKE.
• If there is pair of XX then pad it Y.
• Advantages of Playfair Cipher:
• Simplicity: Easy to understand and implement
• Resistance to Frequency Analysis
• Disadvantages of Playfair Cipher:
• Key Management
• Limited Key Space
• Weak against Known-Plaintext Attacks
• Lack of Perfect Security
Do It Your Self
• Find out the Cipher Text using following Plain Text and keys.
1. PT = Tall trees KEY = occurrence
2. PT = greet KEY = moonmission
3. PT = come to the window KEY = keyword
4. PT = cryptography KEY = security
5. PT = yagnik Key = avptirajkot
Hill Cipher
• This cipher is based on Linear Algebra, Each letter is represented by
numbers from 0 to 25 and calculations are done using modulo 26.
• This Encryption Algorithm takes m successive Plain Text letters and
substitutes them with m Cipher Text letters.
• The substitution is determined by m linear equations. For m = 3, the
system can be described as:
C1 = (K11P1 + K12P2 + K13P3)Mod 26
C2 = (K21P1 + K22P2 + K23P3)Mod 26
C3 = (K31P1 + K32P2 + K33P3)Mod 26
• This can also be expressed in terms of row vectors and matrices, where
C and P are row vectors of length 3 representing the plaintext and
cipher text, and K is a3 X 3 matrix representing the encryption key.
• For example: If the PT= PAYMOREMONEY and if the key is given below ;

• Step :1 (CT for PAY)


C = K (15 0 24) Mod 26
= (11 13 18)
= LNS
• Do the same for all pair that is MOR, EMO, NEY hence,
CT = LNSHDLEWMTRW.
• If in last pair any padding of characters required, then pad with X.
• Encryption and decryption can be given by the following formula,
Encryption: C=P K Mod 26
Decryption: P=C K-1 Mod 26
• Advantages of Hill Cipher:
• Variable Block Size
• Resistance to Frequency Analysis
• Mathematical Complexity
• Disadvantages of Hill Cipher:
• Key Management
• Sensitivity to Key Choice
• Not Suitable for Large Alphabets
• Padding Requirements
• Computational Overhead
Do It Your Self
• Find out the Cipher Text of the following Plain Text and keys.
17 17 5
1. PT = SUMMER KEY = 21 18 21
2 2 19

2 1 3
2. PT = WINTER KEY = 4 2 1
3 6 7
One Time Pad (OTP) Cipher
• This cipher is implemented using Random Key that is as long as the
message, the key is random so that cipher text is too random.
• The key is used to encrypt and decrypt a single message, and then is
discarded (here in this method key is never be reused).
• Only two copies of key are generated, one for sender and one for
receiver.
• Each new message requires a new key of the same length as the new
message.
• The one-time pad is the only cryptosystem that exhibits perfect
secrecy
• Encryption Process:
– Add each corresponding letter of PT to the corresponding alphabets of OTP.
– If the sum produced is greater than or equals to 26 then subtract 26 from it.
– Translate each number of the sum back to corresponding alphabets ,this gives
the output CT.
• Example:
PT = HOWAREYOU & OTP (KEY) = NCBTZQARX

PT H O W A R E Y O U
7 14 22 0 17 4 24 14 20
+
OTP (KEY) N C B T Z Q A R X
13 2 1 19 25 16 0 17 23

INTIAL TOTAL 20 16 23 19 42 20 24 31 43

SUBTRACT 26, 20 16 23 19 16 20 24 5 17
IF => 26

CT U Q X T Q U Y F R
Do It Your Self
• Find out the Cipher Text of the following Plain Text and keys.
1. PT = YAGNIK OTP = USGNIK
2. PT= computer OTP = departme
Transposition Techniques (Encryption Algorithm)
• Transposition Technique:
– A Transposition technique is one in which perform some sort of
permutation on the plain text letters by rearranging their positions.
– In this technique, the position of the character is changed but character’s
identity is not changed.
– Example:
• Rail Fence
Rail Fence
• In this technique encryption involves writing plaintext letters diagonally
over a number of rows, then read off cipher row by row.
• The Plaintext is "DEFEND THE EAST WALL" having a key size or the size
of the row is 3, we get the encryption method below,
D N E T L

E E D H E S W L

F T A A

• The Encrypted Message (Cipher Text):


DNETLEEDHESWLFTAA
• This scheme is very easy to cryptanalyze as no key is involved.
• Advantages of Rail Fence Cipher:
• Ease of Implementation
• Quick Encryption/Decryption
• No Key Distribution
• Disadvantages of Rail Fence Cipher:
• Less Secure
• Predictable Patterns
• Not Suitable for Long Messages
Do It Your Self
• Find out the Cipher Text of the following Plain Text and depth is 2.
1. PT = avptirajkot
2. PT = rajkotgujaratindia
3. PT= digitalindia
Steganography
• The art and science of hiding information (it can be Plain Text, Cipher Text,
Images, etc..) by embedding messages within another message (or even in
image) is called Steganography.

• In this the PT is embedded within another message (or even in image)


hence the data will be confidential from the attacker.

• Basically here two types of materials exist one is message and the other is
cover(carrier) and in this, message is embedded inside a cover to produce
the Stego file, at the receiver end the Stego file is decoded to get original
message..

• The basic structure of a Steganography is given below

cover cover
FE Stego File FE^-1
Message Message
• Types of Steganography are listed below:
• Image Steganography
• Message is embedded within an images.
• LSB Replacement: Embedding information in least significant bits of the
pixels on a particular image.
• Palette Based Image Steganography: Embedding information in the color
palette of an image.
• Audio Steganography
• Message is embedded in Audio.
• Least Significant Bit (LSB) Modification: Embedding information in least
significant bits of the audio on a particular audio file.
• Phase Coding: Modifying the phase of certain audio components to
Embedding the data.
• Text Steganography
• Message is embedded in Text/Document.
• Whitespace Steganography: Embedding information in whitespace of a
particular document or text file.
• Font-based Steganography: Using different fonts or styles to encode
information in text or document file.
• Video Steganography
• Message is embedded in Video.
• Frame-level Embedding: Hiding information in the frames of a video
by altering pixel values.
• Network Steganography
• Message is embedded in Network Protocol.

• Advantages:
• Covert Communication
• Security Enhancement
• Protection Against Data Tampering
• Disadvantages:
• Time Consuming
• Difficult for Large Messages
• Detection Challenges
• Compatibility issue
• Complexity increase
Data Encryption Standard (DES)
• DES is a Symmetric Key Algorithm that was widely used for securing Sensitive
information in the field of information security.
• The basic structure of DES are depicted below;
• Steps of DES Operation in Brief:
• In DES the size of Plain Text is 64 bit, Key is 64 bit (In First Permutation
Permuted Choice-1, it was converted into 56 bit by removing every 8th
bit from Key).
• Initial Permutation (IP) Rearranges the given Input Plain Text and
generate Permuted Output.
• This followed by a Phase consisting of 16 rounds of the same function,
which involves both permutation and substitution functions using a
different key in each round that is the output of Permuted Choice 2.
• The Output of the last (16th Round) consists of 64 bits that are a
function of Plain Text and Key.
• The Left and Right Half of the output are 32 bit swapped to produce
preoutput.
• Finally the preoutput is passed through a permutation (inverse of IP)
to produce a 64 bit Cipher Text.
• Initial Permutation (IP)
• Initial Permutation (IP) Rearranges the given Input Plain Text (64 Bit) and
generate Permuted Output.
• The bits are rearranged according to a fixed permutation table.

• Key Generation
• In Starting key was 64 bit long.
• In First Permutation (Permuted Choice-1), it was converted into 56 bit by
removing every 8th bit from Key.
• Then 56 bit key is split into 28-bit halves.
• Then Left Circular Shift operation is carried out on that two halves, if Round
number is from 1,2,9,16 then 1 bit Left Circular Shift is performed, else 2 bit
Left Circular Shift.
• That output is then used for input for Permuted Choice-2, which is a
compression permutation that select 48 bit from that inputted 56 bit and
rearrange them and that will be a key K1 for Round-1.
• Similarly K1,K2,…..,K16 are used for Round1,2,….16 Respectively.
• Details of Round
• The 64-bit Plain Text is divided into two 32-bit halves: left (L0) and right (R0).
• For each round (16 Total Round), the following operations are performed:
• Expansion: The 32-bit right half is expanded to 48 bits by adding more
required bits
• Key Mixing: The expanded right half is XORed with the round's subkey
derived from the original key.
• Substitution: The result is passed through eight S-Boxes, each providing
4 bits of output, so the output of S-Boxes is 32 bit.
• Permutation (P): The output of the S-boxes is permuted according to a
fixed table.
• XOR with Left Half: The permuted output is XORed with the left half of
the previous round.
• Swap: The left and right halves are swapped, and the process is
repeated for the next round.
• Role of S-Box

• Each S-Boxes S1,2….,8 are having 6 input, from each 6 bit input first and last
bit group in binary represent row of a S-Box, and Inner four bits in binary
selects one column of an S-box.
• Example:
• Avalanche Effect in DES
• Desirable property of any encryption algorithm is that a change in one bit of
the plaintext or of the key should produce a change in many bits of cipher
text.
• DES Performs Strong Avalanche Effect.

• Although the two plaintext blocks differ only in the rightmost bit, the
ciphertext blocks differ in 29 bits.
• This means that changing approximately 1.5 % of the plaintext creates a
change of approximately 45 % in the ciphertext.
• Advantages of DES
• Pioneer in Symmetric Encryption
✓ DES was one of the first widely adopted symmetric key encryption
algorithms, establishing a foundation for modern cryptographic research
and development.
• Standardization
✓ DES was adopted as a federal standard in the United States, providing a
common encryption standard for government and commercial
applications.
• Ease of implementation
• Strong
• Secure
• Disadvantages of DES
• Short Key Length
• Limited Block Size
• Slow in software
• Key Management Challenges
Important Questions
Unit-2 (CO-2)
Sr No. Question
1 Define Following Terms: Cryptography, Cryptanalysis, Cryptanalyst, Cryptology
2 Explain Symmetric Key Encryption with suitable diagram.
3 Explain Asymmetric Key Encryption with suitable diagram.
4 Explain Caesar Cipher Algorithm with example.
5 Explain Playfair Cipher Algorithm with example.
6 If Key=COLGATE, Write Playfair Cipher Key Matrix.
Find cipher text using Playfair cipher for given
7
Plain text is “UNIVERSITY” and Key is “HELLO”.
Find cipher text using Playfair cipher for given:
8
Key: “SECURITY”, Plaintext is: “CRYPTOGRAPHY”.
9 Explain Hill Cipher Algorithm with example.
10 Explain One Time Pad Cipher with example.
11 Explain Rail Fence Cipher with example.
12 Define Steganography and Explain its types in detail.
14 Explain DES with suitable structure diagram of it.

You might also like