0% found this document useful (0 votes)
100 views72 pages

CNS Mod 2

The document is a course outline for a module on Cryptography and Network Security, covering various cryptographic techniques including symmetric and asymmetric ciphers, substitution and transposition methods, and specific ciphers like Caesar, Playfair, and Vigenère. It discusses concepts such as plaintext, ciphertext, encryption, decryption, and cryptanalysis, along with examples and practice problems. The document also highlights the challenges and security aspects of cryptographic systems.

Uploaded by

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

CNS Mod 2

The document is a course outline for a module on Cryptography and Network Security, covering various cryptographic techniques including symmetric and asymmetric ciphers, substitution and transposition methods, and specific ciphers like Caesar, Playfair, and Vigenère. It discusses concepts such as plaintext, ciphertext, encryption, decryption, and cryptanalysis, along with examples and practice problems. The document also highlights the challenges and security aspects of cryptographic systems.

Uploaded by

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

Department of Information Science & Engineering

CRYPTOGRAPHY AND NETWORK SECURITY


IS62214IC
By
Prof. Prajna U R
Assistant Professor
Department of Information Science & Engineering
Sahyadri College of Engineering and Management, Adyar Mangaluru
Email: [email protected]
Mob:8495971075
MODULE-2
Basics of Cryptography and Encryption

Topics to be covered

Introduction to Cryptography, Plain Text and Cipher Text, Symmetric Cipher Model, Cryptography, Cryptanalysis, Brute
Force Attacks, Substitution Techniques - Caesar Cipher and Modified Caesar Cipher, Mono Alphabetic cipher, Poly-
Alphabetic Cipher, Playfair Cipher, Transposition Techniques- Rail Fence technique, Simple Columnar transposition
Technique.
Cryptography
The art or science encompassing the principles and methods of
transforming an intelligible message into one that is unintelligible, and
then retransforming that message back to its original form.

Types of Cryptography
Symmetric (private key )
Asymmetric (public key)
Fig. Cryptographic system
Fig. Cryptanalysis
 Plaintext: original message

 Ciphertext: Coded message

 Enciphering or encryption: converting from plaintext to ciphertext

 Deciphering or decryption: restoring the plaintext from the ciphertext

 Cryptography: The many schemes used for encryption constitute the


area of study known as Cryptography.

 Such a scheme is known as a cryptographic system or a cipher.

 Cryptanalysis: Techniques used for deciphering a message without


any knowledge of the enciphering details. “breaking the code.”

 The areas of cryptography and cryptanalysis together are called


cryptology.
Symmetric Cipher Model Symmetric Cipher
Model
Model of Symmetric Cryptosystem
CryptogrCryptograpy

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

 When two approaches are used together we call the technique as


product cipher.
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


3. Thereferred to as asymmetric,
way in which the plaintexttwo-key, or public-key encryption.
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.
CCryptanalysis and Brute-Force Attackryptanalysnd
Brute-Force Attack
 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


ciphertext until an intelligible translation into plaintext is obtained.
On average, half of all possible keys must be tried to achieve
success.
Types of Attacks on Encrypted Messages
Encryption scheme
 Unconditionally secure: if the ciphertext generated by the scheme
does not contain enough information to determine uniquely the
corresponding plaintext, no matter how much ciphertext is available.

 Computationally secure:

o The cost of breaking the cipher exceeds the value of the


encrypted information.

o The time required to break the cipher exceeds the useful lifetime
of the information.
CryptogrCryptograpy
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.
 For each plaintext letter p, substitute the ciphertext
C C=
letter E(3, p) = (p + 3) mod 26

the general Caesar algorithm is


C = E(k, p) = (p + k) mod 26

where k takes on a value in the range 1 to 25.


The decryption algorithm is simply
p = D(k, C) = (C - k) mod 26

For Caesar cipher, a brute-force cryptanalysis is easily performed:


simply try all the 25 possible keys
 Trying every possible key until an intelligible translation from
cyphertext to plaintext is obtained.

 Guessing

 Software tools
 Crack
 Hydra
 John the ripper
 Hashcat
 CAPTCHA (Completely Automated Public Turing test
to tell Computers and Humans Apart)

 Human being or bot


Ceaser Cipher
Shift cipher
Key= 1,2,3…
Shift cypher with key = 3 is called Caesar cypher
Monoalphabetic Ciphers

 A permutation of a finite set of elements S is an ordered sequence of all the


elements of S, with each element appearing exactly once.

 For example, if S = {a, b, c}, there are six permutations of S:

abc, acb, bac, bca, cab, cba

In general, there are n! permutations of a set of n


elements

Monoalphabetic substitution
cipher
26! or greater than 4 * 1026 possible keys
 The cypher line can be any permutation of 26 alphabetic characters

 A single cipher alphabet (mapping from plain alphabet to cipher


alphabet) is used per message.

CRYPTO
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZVUEPHZH
MDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSXEPYEPOPDZSZUFPOMBZWP
FUPZHMDJUDTMOHMQ
 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

 The great mathematician Carl Friedrich Gauss


believed that he had devised an unbreakable cipher
using homophones.
Practice problem

Encrypt the plain text using Monoalphabetic Cipher

“Attack postponed to tomorrow and do not use our secret paper until further info”

Secret Key: The quick brown fox jumps over the lazy dog

Note: Ignore the second and latter occurrence of alphabets in the key
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

 Manual symmetric encryption technique.

 The Playfair algorithm is based on the use of a 5 * 5 matrix of letters


constructed using a keyword.
Playfair Cipher Encryption Algorithm:

1.Generate the key Square(5×5):

1. The key square 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 the table can hold only 25
alphabets). If the plaintext contains J, then it is replaced by I.

2. The initial alphabets in the key square are the unique alphabets of the key in
the order in which they appear followed by the remaining letters of the
alphabet in order.
Cont…
• Algorithm to encrypt the plain text: The plaintext is
split into pairs of two letters (digraphs). If there is an
odd number of letters, a X is added to the last letter.
• Pair cannot be made with same letter. Break the letter
in single and add a bogus letter to the previous letter.
• If the letter is standing alone in the process of pairing,
then add an extra bogus letter with the alone letter
Rules for Encryption:
• If both the letters are in the same column: Take
the letter below each one (going back to the top if at
the bottom).
• If both the letters are in the same row: Take the
letter to the right of each one (going back to the
leftmost if at the rightmost position).
• If neither of the above rules is true: Form a
rectangle with the two letters and take the letters on
the horizontal opposite corner of the rectangle.
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 both the 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).
• If neither of the above rules is true: Form a
rectangle with the two letters and take the letters on
the horizontal opposite corner of the rectangle.
 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 bottom, 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, according to the following
rules:

 Repeating plaintext letters that are in the same pair are separated
with a filler letter, such as x,

 Eg: balloon would be treated as ba lx lo on.

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


 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.
Practice problem
• When the PT-109 American patrol boat, under the command of
Lieutenant John F. Kennedy, was sunk by a Japanese destroyer, a
message was received at an Australian wireless station in Playfair code:

• KXJEY UREBE ZWEHE WRYTU HEYFS

• KREHE GOYFI WTTTU OLKSY CAJPO

• BOTEI ZONTX BYBNT GONEY CUZWR

• GDSON SXBOU YWRHE BAAHY USEDQ

• The key used was royal new zealand navy. Decrypt the message.
Practice problem
• a. Construct a Playfair matrix with the key largest.

• b. Construct a Playfair matrix with the key occurrence. Make a


reasonable assumption about how to treat redundant letters in the key.
Practice problem
• a. Using this Playfair matrix:

• Encrypt this message:


• Must see you over Cadogan West. Coming at once.
• Note: The message is from the Sherlock Holmes story, The Adventure
of the Bruce- Partington Plans.
• b. Repeat part (a) using the Playfair matrix from Problem in the last
slide.
• c. How do you account for the results of this problem? Can you
generalize your conclusion?
Polyalphabetic Ciphers

1. A set of related monoalphabetic substitution rules is used.

2. A key determines which particular rule is chosen for a given


transformation.
Vigenère Cipher
 The set of related monoalphabetic substitution rules consists of the
26 Caesar ciphers with shifts of 0 through 25

C = (p + k
i i i mod m ) mod 26 Pi = (Ci - k i mod m ) mod 26
Example
Autokey system
• In which a keyword is concatenated with the plaintext itself to provide
a running key.
Vernam Cipher
 Ultimate defense: 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.

 Works on binary data (bits) rather than letters


 Vernam proposed the use of a running loop of tape that eventually
repeated the key

 The system worked with a very long but repeating keyword.

 It can be broken with sufficient ciphertext, the use of known or


probable plaintext sequences, or both.
One-Time Pad
• 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.
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
keys. Any heavily used system might require millions of random
characters on a regular basis. Supplying truly random characters in
this volume is a significant task.
• 2. Even more daunting is the problem of key distribution and
protection. For every message to be sent, a key of equal length is
needed by both sender and receiver. Thus, a mammoth key
distribution problem exists.
• useful primarily for low-bandwidth channels requiring very high
security.
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.
• 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
• message “meet me after the toga party” with a rail fence of depth 2
Row Column Transposition technique
• Form the rectangle.
• Write Row by Row
• Read column by column
• Key order of the column
Hill Cipher
 Hill cipher, developed by the mathematician Lester Hill in 1929.

 Multi-letter cypher

 Group of letter: Digraph, trigraph, polygraph


C = E(K, P) = PK mod 26
P = D(K, C) = CK-1 mod 26 = PKK-1 = P

c = (k p + k p + k p )
1 11 1 21 2 31 3

mod 26
c = (k p + k p + k p )
2 12 1 22 2 32 3

mod 26
 Consider the plaintext “paymoremoney” and use the encryption key

 The first three letters of the plaintext are represented


by the vector (15 0 24).
 Then(15 0 24)K = (303 303 531) mod 26 = (17 17 11) = RRL.

You might also like