Classical Encryption Techniques

Lecturer:

Prof. Dr. Michael Eichberg

Version:
2023-10-19
Based on:

Cryptography and Network Security - Principles and Practice, 8th Edition, William Stallings

Definitions

Plaintext:

Klartext

An original message.

Ciphertext:

Geheimtext oder Chiffretext oder Krytogramm

The coded (encrypted) message.

Encryption(Enciphering):

The process of converting from plaintext to ciphertext.

Decryption(Deciphering):

Restoring the plaintext from ciphertext.

Definitions

Cryptography:

The area of study of the schemes used for encryption.

Cryptographic system/Cipher:

A scheme.

Cryptanalysis:

Techniques used for deciphering a message without any knowledge of the enciphering details

Cryptology:

The areas of cryptography and cryptanalysis.

Simplified Model of Symmetric Encryption

Simplified model of symmetric encryption

Symmetric Cipher Model

There are two requirements for secure use of conventional encryption:

  1. A strong encryption algorithm

  2. Sender and receiver must have obtained copies of the secret key in a secure fashion and must keep the key secure

Model of Symmetric Cryptosystem

Model of symmetric cryptosystem

Cryptographic Systems can be Characterized along three independent dimensions.

  1. The type of operations used for transforming plaintext to ciphertext.

    • Substitution

    • Transposition

  2. The number of keys used.

    Symmetric:

    single-key, secret-key, conventional encryption

    Asymmetric:

    two-key or public-key encryption

  3. The way in which the plaintext is processed.

    • Block Cipher

    • Stream Cipher

Cryptanalysis and Brute-Force Attack

Cryptanalysis

Brute-force attack

Classification of Attacks

Type of Attack:

<Known to Cryptanalyst>

Ciphertext Only:
  • encryption algorithm

  • ciphertext

Known Plaintext:
  • encryption algorithm

  • ciphertext

  • one or more plaintext-ciphertext pairs formed with the secret key

Chosen Plaintext:
  • encryption algorithm

  • ciphertext

  • plaintext message chosen by cryptanalyst, together with its ciphertext generated with the secret key

Classification of Attacks

Chosen Chiphertext:
  • encryption algorithm

  • ciphertext

  • ciphertext chosen by cryptanalyst, together with its corresponding decrypted plaintext generated with the secret key

Chosen Text:
  • encryption algorithm

  • ciphertext

  • plaintext message chosen by cryptanalyst, together with its corresponding ciphertext generated with the secret key

  • ciphertext chosen by cryptanalyst, together with its corresponding decrypted plaintext generated with the secret key

Encryption Scheme Security

Unconditionally secure

Computationally secure

Brute-Force Attack

Substitution Technique

Caesar Cipher

Caesar Cipher Algorithm

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

Mathematically give each letter 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

Algorithm can be expressed as:

\begin{equation*} C = E(3, p) = (p + 3)\; mod\; 26 \end{equation*}

Caesar Cipher Algorithm

A shift may be of any amount, so that the general Caesar algorithm is:

\begin{equation*} C = E(k, p)= (p + k)\; mod\; 26 \end{equation*}

Where k takes on a value in the range 1 to 25; the decryption algorithm is simply:

\begin{equation*} p = D(k,C) = (C - k)\; mod\; 26 \end{equation*}

Brute-Force Cryptanalysis of Caesar Cipher

Key

PHHW

PH

DIWHU

WKH

WRJD

SDUWB

1

OGGV

OG

CHVGT

VJG

VQIC

RCTVA

2

NFFU

NF

BGUFS

UIF

UPHB

QBSUZ

3

MEET

ME

AFTER

THE

TOGA

PARTY

4

LDDS

LD

ZESDQ

SGD

SNFZ

OZQSX

5

KCCR

KC

YDRCP

RFC

RMEY

NYPRW

6

JBBQ

JB

XCQBO

QEB

QLDX

MXOQV

7

IAAP

IA

WBPAN

PDA

PKCW

LWNPU

8

HZZO

HZ

VAOZM

OCZ

OJBV

KVMOT

9

GYYN

GY

UZNYL

NBY

NIAU

JULNS

10

FXXM

FX

TYMXK

MAX

MHZT

ITKMR

11

EWWL

EW

SXLWJ

LZW

LGYS

HSJLQ

12

DVVK

DV

RWKVI

KYV

KFXR

GRIKP

13

CUUJ

CU

QVJUH

JXU

JEWQ

FQHJO

14

BTTI

BT

PUITG

IWT

IDVP

EPGIN

15

ASSH

AS

OTHSF

HVS

HCUO

DOFHM

16

ZRRG

ZR

NSGRE

GUR

GBTN

CNEGL

...

...

...

...

...

...

...

25

QIIX

QI

EJXIV

XLI

XSKE

TEVXC

Brute-Force Cryptanalysis (of Caesar Cipher)

Decryption is more complicated when the plaintext is already garble. E.g., as in case of a compressed file as seen below.

00000000:

504b

0304

1400

0800

0800

afb1

4257

0000

PK..........BW..

00000010:

0000

0000

0000

4f04

0000

0a00

2000

322d

......O....._.2-

00000020:

4465

6d6f

2e74

7874

5554

0d00

076a

241b

Demo.txtUT...j$.

00000030:

656a

241b

656a

241b

6575

780b

0001

04f8

ej$.ej$.eux.....

00000040:

0100

0004

1400

0000

edcc

db09

8030

0c05

.............0..

00000050:

d07f

a7c8

049d

a28b

c4f6

6203

e983

18d0

..........b.....

00000060:

6e2f

ee91

ffc3

c928

b697

cb1c

2437

f569

n/.....(....$7.i

00000070:

a032

fb52

29ec

a8f4

340c

f206

5aca

321c

.2.R)...4...Z.2.

00000080:

afff

8cd5

c075

d3c5

762a

d291

2389

2492

.....u..v*..#.$.

00000090:

48d2

0750

4b07

081d

a9b0

b94b

0000

004f

H..PK......K...O

000000a0:

0400

0050

4b01

0214

0314

0008

0008

00af

...PK...........

000000b0:

b142

571d

a9b0

b94b

0000

004f

0400

000a

.BW....K...O....

000000c0:

0020

0000

0000

0000

0000

00a4

8100

0000

._..............

000000d0:

0032

2d44

656d

6f2e

7478

7455

540d

0007

.2-Demo.txtUT...

000000e0:

6a24

1b65

6a24

1b65

6a24

1b65

7578

0b00

j$.ej$.ej$.eux..

000000f0:

0104

f801

0000

0414

0000

0050

4b05

0600

...........PK...

00000100:

0000

0001

0001

0058

0000

00a3

0000

0000

.......X........

Monoalphabetic Cipher

English Letter Frequency

English letter frequency (alphabetic)

Monoalphabetic Ciphers

Easy to break because they reflect the frequency data of the original alphabet.

Countermeasure is to provide multiple substitutes (homophones) for a single letter.

Playfair Cipher

Playfair Key Matrix

Fill in letters of keyword (minus duplicates) from left to right and from top to bottom, then fill in the remainder of the matrix with the remaining letters in alphabetic order. The letters I and J count as one letter.

Using the keyword MONARCHY:

M

O

N

A

R

C

H

Y

B

D

E

F

G

I/J

K

L

P

Q

S

T

U

V

W

X

Z

Playfair Encryption

Enryption is done on each pair of letters of the plaintext.

  1. If both letters are the same (or only one letter is left), add an "X" after the first letter. Encrypt the new pair and continue. (e.g., ballon would be encryped as ba lx lo on)

  2. If the letters appear on the same row, replace them with the letters to their immediate right respectively (wrap around if necessary). (e.g., ar is encrypted as RM)

  3. If the letters appear on the same column, replace them with the letters immediately below respectively (wrap around if necessary). (e.g., mu is encrypted as CM)

  4. If the letters are not on the same row or column, replace them with the letters on the same row respectively but at the other pair of corners of the rectangle defined by the original pair. (e.g., hs is encrypted as BP and ea as IM)

Hill Cipher

Polyalphabetic Ciphers

Polyalphabetic substitution ciphers improve on the simple monoalphabetic technique by using different monoalphabetic substitutions as one proceeds through the plaintext message.

Vigenère Cipher

Vigenère-Tableau

/

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

A

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

B

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

A

C

C

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

D

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

E

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

D

F

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

G

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

H

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

I

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

J

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

K

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

L

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

M

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

N

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

O

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

P

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

Q

Q

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

R

R

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

S

S

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

T

T

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

U

U

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

V

V

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

W

W

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

X

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

Y

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Z

Z

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

Let's assume the key is D, the plaintext character is b then the ciphertext letter is E.

Example of Vigenère Cipher

Vigenère Autokey System

Even this scheme is vulnerable to cryptanalysis, because the key and the plaintext share the same frequency distribution of letters, a statistical technique can be applied.

Vernam Cipher

Vernam Cipher

One-Time Pad

Difficulties when using a One-Time Pad

Rail Fence Cipher

Row Transposition Cipher

Steganography

Dear Friend ; We know you are interested in receiving cutting-edge announcement . If you are not interested in our publications and wish to be removed from our lists, simply do NOT respond and ignore this mail . This mail is being sent in compliance with Senate bill 1626 ; Title 4 , Section 305 . This is a ligitimate business proposal ! Why work for somebody else when you can become rich in 96 months . Have you ever noticed nobody is getting any younger & nobody is getting any younger . Well, now is your chance to capitalize on this ! We will help you decrease perceived waiting time by 170% and use credit cards on your website ! You are guaranteed to succeed because we take all the risk ! But don't believe us . Mrs Anderson of Indiana tried us and says "I was skeptical but it worked for me" . We assure you that we operate within all applicable laws . You will blame yourself forever if you don't order now . Sign up a friend and you'll get a discount of 10% ! Thank-you for your serious consideration of our offer !

Use Spammimic https://www.spammimic.com/ to unhide the message.

Other Steganography Techniques

Character marking

Selected letters of printed or typewritten text are over-written in pencil. The marks are not visible unless the paper is held at an angle to bright light.

Invisible ink

A number of substances can be used for writing but leave no visible trace until heat or some chemical is applied to the paper.

Pin punctures

Small pin punctures on selected letters are ordinarily not visible unless the paper is held up in front of a light.

...

Steganography vs. Encryption

Steganography has a number of drawbacks when compared to encryption:

The advantage of steganography: