Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

PSG Institute of Technology and Applied Research

Neelambur, Coimbatore – 641 062


Department of Computer Science and Engineering

CS8792 Cryptography and


Network Security
Session 4,5,6
Dr.I.Kala
Associate Professor/CSE
PSGiTECH
Outline of the presentation
• Classical Encryption Techniques
– Substitution Technique
– Transposition Technique

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 2


Classical Substitution Ciphers
• where letters of plaintext are replaced by other letters or by
numbers or symbols
• or if plaintext is viewed as a sequence of bits, then
substitution involves replacing plaintext bit patterns with
ciphertext bit patterns

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 3/97


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

C = E(p) = (p + 3) mod (26)


p = D(C) = (C – 3) mod (26)

• mathematically give each letter a number


a b c d e f g h i j k l m
0 1 2 3 4 5 6 7 8 9 10 11 12
n o p q r s t u v w x y Z
13 14 15 16 17 18 19 20 21 22 23 24 25
• then have Caesar cipher as:
C = E(p) = (p + k) mod (26) Text : ATTACKATONCE
p = D(C) = (C – k) mod (26) Shift: 4
Cipher: EXXEGOEXSRGI

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 4/97


Monoalphabetic Cipher
• rather than just shifting the alphabet
• could shuffle (jumble) the letters arbitrarily
• each plaintext letter maps to a different random ciphertext
letter
• hence key is 26 letters long
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN

Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 5/97


Playfair Cipher with Key Matrix
• a 5X5 matrix of letters based on a keyword
• fill in letters of keyword (sans duplicates)
• fill rest of matrix with other letters
• eg. using the keyword MONARCHY , Plain Text : baloon
MONAR
CHYBD
EFGIK
LPQST
UVWXZ
1. if a pair is a repeated letter, insert a filler like 'X', eg. "balloon" encrypts as "ba lx lo
on"
2. if both letters fall in the same row, replace each with letter to right (wrapping back to
start from end), eg. “ar" encrypts as "RM"
3. 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"
4. 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)

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 6/97


Encrypting and Decrypting
• plaintext encrypted two letters at a time:
1. if a pair is a repeated letter, insert a filler like 'X', eg. "balloon"
encrypts as "ba lx lo on"
2. if both letters fall in the same row, replace each with letter to
right (wrapping back to start from end), eg. “ar" encrypts as
"RM"
3. 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"
4. 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)
• plaintext "hide the gold in the tree stump“
• key playfair example

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 7/97


Playfair Cipher Example
plaintext "hide the gold in the tree stump“
key playfair example

Plain Text

Cipher Text

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 8


Polyalphabetic Ciphers
• another approach to improving security is to use multiple
cipher alphabets
• called polyalphabetic substitution ciphers
• makes cryptanalysis harder with more alphabets to guess
and flatter frequency distribution
• use a key to select which alphabet is used for each letter of
the message
• use each alphabet in turn
• repeat from start after end of key is reached

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 9/97


Vigenère Cipher
• simplest polyalphabetic substitution cipher is the Vigenère Cipher
• effectively multiple caesar ciphers
• key is multiple letters long K = k1 k2 ... kd

key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext:ZICVTWQNGRZGVTWAVZHCQ
YGLMGJ

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 10/97


Vigenere Cipher

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 11


Example
• write the plaintext out
• write the keyword repeated above it
• use each key letter as a caesar cipher key
• encrypt the corresponding plaintext letter
• eg using keyword deceptive
key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 12/97


Vernam Cipher Example

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 13


One-Time Pad
• if a truly random key as long as the message is used, the cipher will be
secure
• is unbreakable since ciphertext bears no statistical relationship to the
plaintext
• since for any plaintext & any ciphertext there exists a key mapping
one to other
• can only use the key once though have problem of safe distribution of
key

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 14/97


POLL QUESTION

•One time pad (Find the Plain text):

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 15/97


Transposition Ciphers
• now consider classical transposition or permutation ciphers
• these hide the message by rearranging the letter order
• without altering the actual letters used
• can recognise these since have the same frequency distribution as the
original text

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 16/97


Rail Fence cipher
• write message letters out diagonally over a number of rows
• then read off cipher row by row
• eg. write message out as:
m e m a t r h t g p r y
e t e f e t e o a a t
• giving ciphertext
MEMATRHTGPRYETEFETEOAAT

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 17/97


Row Transposition Ciphers
• a more complex scheme
• write letters of message out in rows over a specified number of
columns
• then reorder the columns according to some key before reading off the
rows
Single Columnar Transposition
Key: 3 4 2 1 5 6 7
Plaintext: a t t a c k p
o s t p o n e
d u n t i l t
w o a m x y z
Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
Double Columnar Transposition
Key: 3 4 2 1 5 6 7
Plaintext: t t n a a p t
m t s u o a o
d w c o i x k
n l y p e t z
Ciphertext:AUOPNSCYTMDNTTWLAOIEPAXTTOKZ

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 18/97


GUESS?
• Match the following:
GROUPA GROUPB
i. BOOB VOJWFSTJUZ - (a) psgitech
ii. YDOXDEOH - (b) anna university
iii. CHAMPION - (c) cryptographist
iv. CYTGAHSRPORPIT - (d) valuable

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 19/97


???? HOW
• The months of the calendar have been coded in the
following ways:

January = 1071, February = 682, March = 1353, April = 154, May = 1335, June =
1046, July = 1047
August = 168
Predict the Cipher text for September?

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 20/97


ANSWERS

1. Match the following and Infer the Encryption technique :


GROUPA GROUPB
i. BOOB VOJWFSTJUZ - anna university (TECHNIQUE Mono Alphabetic
Substitution)
ii. YDOXDEOH - valuable (TECHNIQUE
Caesar Cipher C=P+3)
iii. CHAMPION - psgitech (TECHNIQUE Poly Alphabetic
Substitution)
iv. CYTGAHSRPORPIT - cryptographist (TECHNIQUE railfence)

2. Cipher text for September : 1999 - 19 is Numerical value of


S , 9 is letters in September, 9 is 9th month

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate 21/97


QUIZ 1 – ASSESSMENT

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 22


FEEDBACK

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 23


Security Mechanisms (X.800)
– encipherment, digital signatures, access controls,
data integrity, authentication exchange, traffic
padding, routing control, notarization

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 24


Privacy Mechanisms

1. Encryption (Encipherment)
It is the process of encoding information into a secret
code by using a special key.
To read an encrypted file, you must have the key of the
decoding that enables you to decrypt it.
By using an algorithm for encryption we can protect our
personal information that we don’t want other people to
see such as:
- Credit-card information
- Bank-account information
- Medical information

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 25


Privacy Mechanisms

2. Digital Signature
A digital signature is basically a way to ensure that an
electronic document is authentic. Authentic means that
you know who created the document and that it has not
been altered.

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 26


Privacy Mechanisms
This figure tells us that 3. Hash Functions and
a hash function
creates a fixed length Message Digest
string from a block
of data. It is also
called a message
digest function.

These (fast)
functions analyze a
message and
produce a fixed
length digest which
is practically unique.
It is used to create a
signature for a
message which can
be used to verify its
integrity

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 27


Privacy Mechanisms

4. Access Control
Access control is way of talking about controlling access
to a web resource. Access can be granted or denied based
on a wide variety of criteria, such as the network address
of the client, the time of day, or the browser which the
visitor is using.

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 28


Privacy Mechanisms
5. Traffic Padding
• It is the process of intercepting and examining messages in
order to deduce information from patterns in
communication.
• The attacker might not know what A and B were talking
but he could know that they were talking and how much
they talked.
• Padding messages is a way to make it harder to do traffic
analysis. A number of random bits are appended to the end
of the message.

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 29


Privacy Mechanisms
6. Routing control
Enables selection of a particular physically secure route for
certain data and allows routing changes, especially when a
breach of security is suspected.
7. Notarization
It’s the use of a third party to assure the other party.

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 30


Interaction

9/1/2020 CS8792: Cryptography and Network Security / Dr I Kala, Associate Professor/CSE 31

You might also like