Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Chapter 2

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 44
At a glance
Powered by AI
The document discusses various classical ciphers like the Caesar cipher, rail fence cipher and columnar transposition cipher. It also covers cryptanalysis techniques like frequency analysis and brute force attacks. Modern ciphers like the one-time pad and concepts like plaintext, ciphertext, encryption and decryption are explained.

The document discusses classical substitution ciphers like the Caesar cipher and modern ciphers like the one-time pad. It also covers classical transposition ciphers like the rail fence cipher and columnar transposition cipher.

Symmetric encryption uses the same key for both encryption and decryption, while asymmetric encryption uses a public key to encrypt and a private key to decrypt. Symmetric encryption provides faster encryption but asymmetric provides non-repudiation.

Chapter Two:

Classic Cryptography

Index
A. Introduction
A.1 Cryptosystems
A.2 Terminology
B. Classic Cipher (Substitution Cipher)
B.1 Caesar Cipher
B 2 Tap Code
B.3 Pigpen Cipher
B 4 Vigenere Cipher
B 5 Book Cipher
C. Cryptanalysis of Substitution Cipher
C.1 Brute force cryptanalysis
C.2 Frequency Distribution Analysis
D. Calculation of Modulo operation
E. One-Time Pad
F. Classic Cipher( Transposition Cipher)
F.1 Route Cipher
F.2 Rail Fence Cipher
F.3 Column Cipher

Cryptosystems
A. Ciphers

C.
C. Modern
Modern

B.
B. Classic
Classic

B.1
B.1 Substitution
Substitution
e.g.,
e.g.,
Caesar
Caesar Cipher
Cipher

B.2
B.2 Transposition
Transposition
e.g.,
e.g.,
Route
Route Cipher
Cipher

B.3
B.3
Hybrid
Hybrid

C.1
C.1 Symmetric
Symmetric
((Private
Private Key
Key))

Stream
Stream Cipher
Cipher
e.g.,
e.g.,
RC4,
RC4, A5/1
A5/1

C.2
C.2 Asymmetric
Asymmetric
Public Key
((Public
Key))
e.g.,
e.g.,
RSA
RSA

Block
Block Cipher
Cipher
e.g.,
e.g.,
DES,
DES, AES
AES

C.3
C.3
Hybrid
Hybrid

A. Terminology
4

Cryptology is the art and science of making and


breaking secret codes.
Cryptography is the making of secret codes.
Cryptanalysis is the breaking of secret codes.
Crypto is a synonym for any or all of the above
(and more).
Cipher ( )is an algorithm for performing
encryption and decryption a series of welldefined steps that can be followed as a procedure.

Terminology
5

Encryption is the process of encoding a message so that


its meaning is not obvious
Equivalent terms: encode, encipher

Decryption is the reverse process, transforming an


encrypted message back into its normal, original form
Equivalent terms: decode, decipher
Encrypt
Plaintext

Ciphertext
Decrypt

Terminology
6

Encryption/decryptions algorithms often use a device


called a key, so that the resulting ciphertext depends on
the original plaintext message, the algorithm, and the
key value
An encryption scheme that does not require the use of a
key is called a keyless cipher
Encrypt

Plaintext

Ciphertext
Decrypt

Terminology
7

Plaintext: message to be encrypted


Ciphertext: encrypted message
DK(EK(P)) = P
Encryption to provide confidentiality

Plaintext
message
At 2 o'clock
..

Encrypt key
k

Decrypt key
k

Encrypt

Decrypt
&*k+u7@~1
transmitted over an
insecure channel.

Plaintext
message

Terminology
8

Symmetric uses same key for encryption and


decryption process.
To encrypt: C = E(K, P)
To decrypt: P = D (K, E(K,P))

Asymmetric uses different key for encryption


and decryption process.
To encrypt: C = E (KE,P)
To decrypt: P = D (KD, E (KE,P))

B. Classic Cipher
9

1. Substitution Ciphers:
exchange one letter (or more) with another
letter/number/symbol/sound/art
A mono-alphabetic cipher uses fixed substitution over the
entire message,
A poly-alphabetic cipher uses a number of substitutions at
different times in the message

2. Transposition Ciphers:
re-arrange the order of the letters

B.1. Substitution Ciphers


1. Caesar Cipher
10

Idea: each letter or group of letters is replaced


by another letter or group of letters
Caesar cipher circularly shift by 3 letters
a -> D, b -> E, z -> C
More generally, shift by k letters, k is the
key

B.1. Substitution Ciphers


1. Caesar Cipher
11

It is monoalphabetic cipher uses addition modulo 26


The message must be a sequence of letters, each letter is
identified with a number:

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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

The key k is a number in the range 1 25.

Advantages and Disadvantages:


The Caesar cipher is quite simple
The ability of predict the entire algorithm using small piece
of ciphertext

B.1. Substitution Ciphers


1. Caesar Cipher (Algorithms)
12

Encryption/decryption involve k to each letter


(mod 26). So the general Caesar algorithm is
Ci= Ek(Mi) = E(Mi, k) = (Mi+k) mod 26
Mi= Dk(Ci) = D(Ci, k) = (Ci-k) mod 26

For example,
Plaintext : treaty impossible
Key
:3
Ciphertext: wuhdwb lpsrvvleoh

That is, Ci=E[Mi , 3] = Mi+3 mod 26

B.1. Substitution Ciphers


1. Caesar Cipher

It is the simplest monoalphabetic cipher. Caesar cipher using the shift parameter as the
key:

Example: Caeser Cipher (Encryption)


14

Example: Caesar Cipher (Decryption)

15

Example: Caesar cipher (Encryption)


Use the Caesar cipher with key=15 to encrypt the
message hello

text: WTAAD

Example: Caesar Cipher (Decryption)


Use the Caesar cipher with key=15 to

WTAAD

xt: hello

decrypt the message

Questions Review
Q1. Use the Caesar cipher to find the plaintext and the key from the
ciphertext:
Ciphertext : ugehmlwj kwumjalq
Q2. Use the Caesar cipher with key=3 to encrypt the next message:
Plaintext: the quick brown fox jumps over the lazy dog

B.1. Substitution Ciphers


2. Tap Code
19

Each letter is replaced by a number of beeps

Substitution Cipher
Pigpen Cipher
Each letter is replaced by an art

20

B.1. Substitution Ciphers


3. Vigenre Cipher
21

Polyalphabetic ciphers flatten the frequency


distribution of the plaintext considerably.
Vigenre Cipher is an example of polyalphabetic
ciphers - use different monoalphabetic substitutions
as one proceeds through the plaintext message.
For example:
meet me at tenPlaintext (M)
badb ad ba dba Key (K)
nehu mh bt wfnCiphertext(C)
where C = M+K mod 26

B.1. Substitution Ciphers


3. Vigenre Cipher
22

Vigenre Tableau

B.1. Substitution
3.Vigenere algorithm
23
is a Polyalphabetic Cipher that
uses Caesar Cipher with more
than one key.

This

B.1. Substitution
3.Vigenere algorithm
We can notice from the above example that four keys are used for encryption
and decryption.
- Keys range from 1 to 25.
- Four keys are used in the above example (5,9,18 and 24)
- Encryption is done by using first key ( i.e. 5) to encrypt first letter A, Second
letter B is encrypted using key =9 and C is encrypted using key 18 and a letter
D is encrypted using key= 24.
- When we used all keys the process is repeated and a second round is made. So
when we reach letter E, we encrypt it again using key = 5 and letter F is
encrypted using key=9 and etc
- To decrypt the cipher, we should know what the letters that each key encrypts
is. This is can be done by using array of letter indexes (i.e. Key = 5 encrypts
letter in indexes 0, 4,8,12 .
- The Excel sheet will spread to the students and they should try it by adjusting
some parameters keys.
-

Question Review
Q1:Use the Vigenere cipher with key=lemon to
encrypt the message attackatdawn

B.1. Substitution Ciphers


4. Book Cipher
26

Any book can provide a key


The key is formed from the letter of the text
Steps:
1.select a passage (Key)
the page cannot be found

2.match the plaintext with selected text.


Plaintext MACHINES CANNOT THINK

3.encode plaintext using Vigenere table

B.1. Substitution Ciphers


Cryptanalysis
27

1. Brute force cryptanalysis: would have to try 26! permutations


of a particular ciphertext message.

- Students can guess the key by using brute force technique. - For example in the above
program, the key was set to 3.

Brute force cryptanalysis (cont)


Try key = 0, the decrypted cipher will be:
Try key = 1, the decrypted cipher will be:
Try key = 2, the decrypted cipher will be:

Try key = 3, the decrypted cipher will be:

Matched!!
So key =3

B.1. Substitution Ciphers


Cryptanalysis (cont)
2. Frequency Distribution Analysis: In practice, it is not difficult to
determine the key using frequencies of letters, pairs of letter etc., or by
guessing a probable word or phrase
Most frequently occurred
Letters: e, t, o, a, n,
Digrams: th, in, er, re, an,
Trigrams: the, ing, and, ion, ent
Words: the, of, and, to, a, in, that,

B.1. Substitution Ciphers


7. One-Time Pads
30

B.1. Substitution Ciphers


7. One-Time Pads (using Bits)
31

One-time pad: construct an unbreakable cipher

Choose a random bit string as the key


Convert the plaintext into a bit string
Compute the XOR of these two strings, bit by bit
The resulting ciphertext cannot be broken, because in a
sufficiently large sample of ciphertext, each letter will occur
equally often, as will every diagram, every trigram, and so on
=> There is simply no information in the message because all
possible plaintexts of the given length are equally likely
The Vernam Cipher is a type of one-time pad devised by Gilbert
Vernam for AT&T

Calculation of MOD operation


Calculate the following mod:
E.g., (5) mod 21
=5
(30) mod 21
= (9) mod 21
=9

Calculation Negative MOD


Modula always return non-negative number:
Calculate the following mod
E.g., (-57) mod 21
= (-36) mod 21
= (-15) mod 21
= (6) mod 21
=6

B.1. Substitution Ciphers


7. One-Time Pads (using ASCII Code)
34

Plaintext

8 15 7

17

Numeric Equivalent

21 4 17 13 0 12 2

+ Random Number

76 48 16 82 44 3 58 11 60 5 47

= Sum
= mod 26

88

97 52 33 95 44 15 60 19 75 12 51 105
19 0

7 17 18 15 8 19 23 12 25

Ciphertext

Ciphertext

Numeric Equivalent
- One-time pad
= Difference

19 0

7 17 18 15 8 19 23 12 25

76 48 16 82 44 3 58 11 60 5 47

1
88

-57 -48 -9 -65 -26 12 -50 8 -37 7 -22 -87

= mod 26

21 4 17 13 0 12 2

8 15 7

17

Plaintext

B.1. Substitution Ciphers


7. One-Time Pads
35

Observations:
The repeated letter comes from different plaintext letters
Duplicate ciphertext letters are generally unrelated when this
encryption algorithm is used => there is no information in the
message to be exploited

Disadvantages
The key cannot be memorized, both sender and receiver must
carry a written copy with them
Total amount of data can be transmitted is limited by the amount
of key available
Aabsolute synchronisation is between sender and receiver,
otherwise, it fails completely to protect message integrity)

B.2. Transposition Ciphers


36

Transposition cipher reorders (rearrange)


symbols but does not disguise them. It is also
called permutation
With transposition, the cryptography aims for
diffusion
Widely spreading the information from the message
or the key across the ciphertext
Transpositions try to break established patterns

B.2. Transposition Ciphers


1. Route Cipher
37

B.2. Transposition Ciphers


2. Rail Fence Cipher
38

B.2. Transposition Ciphers


3. Columnar Transposition
39

Plaintext written in rows


Number of columns = key length
Key is used to number the columns
Ciphertext reads out by columns, starting with
column whose key letter is lowest

B.2. Transposition Ciphers


3. Columnar Transposition
40

For example:
Plaintext (M): WE ARE DISCOVERED FLEE AT ONCE
Key (K):
632415

Ciphertext(C): EVLNE ACDTK ESEAQ ROFOJ DEECU WIREE

Example:Columnar cipher

Ciphertext(C): EVLNX ACDTX ESEAX ROFOX DEECX


WIREE
Key: 632415

Plaintext (M): WE ARE DISCOVERED FLEE AT ONCE

Question review
Q1. Encrypt the following plaintext using Columnar
transposition:
We are going to university every day
Use your Last name as keyword
Q2.use the rail fence Cipher (3 rails) to encode the following plaintext
Plaintext: We are going to university every day

Question review
Q3. They

are 4! = 24 possible combinations for the


substations. Here some sample:

Q4 . By using brute force we must try all 24 choices until we


break the cipher.

Terms and Concepts


Encryption & Decryption
Plaintext & Ciphertext
Algorithm & Cipher
Cryptology
Cryptography & Cryptanalysis
Key
Substitution & Transposition
Monoalphabetic Ciphers & Polyalphabetic Ciphers

44

You might also like