Sie sind auf Seite 1von 27

Conventional Encryption: Classical Techniques

Introduction to Cryptography

Cryptography
Cryptography is the study of secret (crypto-) writing g (( g graphy) p y) Concerned with developing algorithms which may be used to:
C Conceal l the th context t t of f some message from f all ll except t the th sender d and d recipient (privacy or secrecy), and/or Verify the correctness of a message to the recipient (authentication g y) or integrity)

Basis of many technological solutions to computer and communications security problems

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

Introduction to Cryptography

Basic Terminology
Cryptography
The art or science encompassing the principles and methods of g message g an intelligible g into one that is transforming unintelligible, and then retransforming that message back to its original form

Plaintext
The original intelligible message

Ciphertext
The transformed message

Cipher
An algorithm for transforming an intelligible message into one that is unintelligible by transposition and/or substitution methods

Key
Some critical information used by the cipher cipher, known only to the sender & receiver

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

Introduction to Cryptography

Basic Terminology - 2
Encipher (encode)
Process of converting plaintext to ciphertext using a cipher and a key

Decipher (decode)
The p process of converting g ciphertext p back into plaintext p using g a cipher and a key

Cryptanalysis (codebreaking)
The study of principles and methods of transforming an unintelligible message back into an intelligible message without knowledge of the key.

Cryptology
The field encompassing both cryptography and cryptanalysis

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

Introduction to Cryptography

Basic Terminology - 3
Encryption
The mathematical function mapping plaintext to ciphertext using the specified key: Y = EK(X)

Decryption
The mathematical function mapping ciphertext to plaintext using the specified key: X = DK(Y) = EK-1(Y)

C Cryptographic t hi system t
The family of transformations from which the cipher function EK is chosen

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

Conventional Encryption Model

Simplified Conventional Encryption Model

N t secret Not t

Conventional
Private-Key Secret-Key Single-Key Symmetric ( Public-Key)

( Asymmetric)
H. Yoon

Cryptography & Network Security

Conventional Encryption: Classical Techniques

Conventional Encryption Model

Conventional Cryptosystem Model

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

Conventional Encryption Model

Cryptanalysis
Process of attempting to discover X or K or both both. Various types of cryptanalytic attacks

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

Conventional Encryption Model

Exhaustive Key Search


Al Always th theoretically ti ll possible ibl to t simply i l try t every key k Most basic attack, directly proportional to key size Assume either know or can recognize when plaintext is found
Average Time Required for Exhaustive Key Search

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

Conventional Encryption Model

Unconditional and Computational Security


Unconditionally secure
No matter how much computer power is available, the cipher cannot be broken since the cipher text provides insufficient information to uniquely determine the corresponding plaintext

Computationally secure
The cost of breaking the security exceeds the value of th secured the d service i or information. i f ti The time required to break the security exceeds the useful lifetime of the information

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

10

Classical Encryption Techniques

Classical Encryption Techniques


Substitution Techniques
Caesar Cipher Monoalphabetic Ciphers Playfair Cipher Hill Cipher p Polyalphabetic Ciphers

Transposition (Permutation) Techniques


Rail Fence Technique Block (Columnar) Transposition Technique

Product Techniques
Substitution and transposition p ciphers p are concatenated

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

11

Classical Encryption Techniques

Caesar Cipher
2000 years ago, by Julius Caesar A simple substitution cipher cipher, known as Caesar cipher Replace each letter with the letter standing 3 places further down the alphabet
Plain: Cipher: meet me after the toga party PHHW PH DIWHU WKH WRJD SDUWB

ci=E(pi)=(pi+3) mod 26; pi=D(c ( i)=(c ) ( i-3) 3) mod 26 No key, just one mapping (translation)
Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cipher: DEFGHIJKLMNOPQRSTUVWXYZABC

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

12

Classical Encryption Techniques

Generalized Caesar Cipher


Can use any shift from 1 to 25, i.e., replace each letter by a letter a fixed distance away ci=E(pi)=(pi+k) mod 26; p=D(ci)=(ci-k) mod 26 Shift cipher Key = k Key letter: the letter a plaintext A maps to
e.g. a key letter of F means A maps to F, B to G, , Y to D, Z to E

Hence have 26 (25 useful) ciphers


Key space = 26

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

13

Classical Encryption Techniques

Brute-Force Cryptanalysis of Caesar Cipher

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

14

Classical Encryption Techniques

Monoalphabetic Substitution Ciphers


Further generalization of the Caesar cipher,
Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ Ci h Cipher: DEFGHIJKLMNOPQRSTUVWXYZABC

is obtained by allowing any permutation of 26 characters for the cipher Key size = 26 Key space = 26! 4x1026 Unique mapping of plaintext alphabet to ciphertext alphabet Monoalphabetic For a long time thought secure, but easily breakable by frequency analysis attack

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

15

Classical Encryption Techniques

Relative Frequency of Letters in English Text

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

16

Classical Encryption Techniques

Frequency Statistics of Language


In addition to the frequency info of single letters, the frequency info of two-letter (digram) or three-letter (t i (trigram) ) combinations bi ti can be b used d for f the th cryptanalysis Most frequent digrams
TH, HE, IN, ER, RE, AN, ON, EN, AT

Most frequent trigrams


THE, ING, AND, HER, ERE, ENT, THA, NTH, WAS, ETH, FOR, DTH

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

17

Classical Encryption Techniques

Homophones
Monoalphabetic substitution ciphers are easy to cryptanalyze through letter frequency analysis Multiple M lti l substitutes b tit t (homophones) (h h ) for f a single i l letter l tt can be used to hide the single-letter frequency information But B t even with ith homophones, h h multiple-letter lti l l tt patterns tt (e.g. digram frequencies) still survive in the ciphertext Two approaches for this problem
Encrypt multiple letters of plaintext Playfair y cipher p Hill cipher Use multiple cipher alphabets Polyalphabetic cipher

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

18

Classical Encryption Techniques

Playfair Cipher
Best-known multiple-letter substitution cipher Digram cipher (diagram to digram, i.e., E(pipi+1)=cici+1 through key key-based based 5x5 transformation table)
M C E L U O H F P V N Y G Q W A B I/J S X R D K T Z

Keyword = monarchy Plaintext: H S E A A R M U Ciphertext: B P I M R M C M

Great advance over simple monoalphabetic cipher (26 letters 26x26=676 digrams) Still leaves much of the structure of the plaintext language relatively easy to break Can be generalized to polygram cipher
Cryptography & Network Security H. Yoon

Conventional Encryption: Classical Techniques

19

Encryption rules
Repeating p g paintext p letters that fall in the same pair p are separated with a filler letter, such as x. Plaintext letters that fall in the same row are replaced by the letter to the right right, with the first element of the row circularly following the last. Plaintext letters that fall in the same column are replaced l d by b the th l letter tt below, b l with ith the th top t element l t of f the row circularly following the last. Otherwise, , each plaintext p letter is replaced p by y the letter that lies in its own row and the column .

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

20

Classical Encryption Techniques

Relative Frequency of Occurrence of Letters

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

21

Classical Encryption Techniques

Hill Cipher
Multiletter cipher Takes m successive p plaintext letters and substitutes for them m ciphertext letters 3x3 Hill cipher: c1 = (k11p1 + k12p2 + k13p3) mod 26
c2 = (k21p1 + k22p2 + k23p3) mod 26 c3 = (k31p1 + k32p2 + k33p3) mod 26

1C = K-1 1KP = P C = EK(P) = KP; P=DK(C)=K-1 m x m Hill cipher hides (m-1)-letter frequency info Strong against for the plaintext-only plaintext only attack, but easily broken with known plaintext attack

with m plaintext-ciphertext pairs, each of length m; K = CP-1

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

22

Classical Encryption Techniques

Polyalphabetic Cipher
Typically a set of monoalphabetic substitution rules is used Key determines which rule to use

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

Vigenre cipher

23

Classical Encryption Techniques

Best-known polyalphabetic ciphers Each key letter determines one of 26 Caesar (shift) ciphers ci = E(pi) = pi + ki mod(key length) Example: Key: deceptivedeceptivedeceptive
Plaintext: Cipheretxt: wearediscoveredsaveyourself ZICVTWQNGRZGVTWAVZHCQYGLMGJ

Keyword is repeated to make a key as long as the plaintext Given a sufficient amount of ciphertext, common sequences are repeated, exposing the period (keyword l length) h) Target T of f the h cryptanalysis l i
Cryptography & Network Security H. Yoon

Conventional Encryption: Classical Techniques

Vigenre cipher - 2

24

Classical Encryption Techniques

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

Vigenre cipher - 3

25

Classical Encryption Techniques

If the keyword length is N, then Vigenre cipher, in effect, consists of N monoalphabetic substitution ciphers Improvement p over the Playfair y cipher, p , but language g g structure and frequency information still remain

Vigenre autokey system: after key is exhausted, use plaintext for running key (to eliminate the periodic nature)
Key: Plaintext: Cipheretxt: deceptivewearediscoveredsav wearediscoveredsaveyourself ZICVTWQNGKZEIIGASXSTSLVVWLA

K Key and d plaintext l i t t share h the th same frequency f distribution di t ib ti of f letters a statistical technique can be used for the cryptanalysis, (e.g., e enciphered with e would occur with a frequency of (0.1275)2 0.0163, t enciphered with t would occur with a frequency of (0.0925)2 0.0086, etc.)
Cryptography & Network Security H. Yoon

Conventional Encryption: Classical Techniques

26

Classical Encryption Techniques

One-Time Pad
Perfect substitution cipher Use a random key (pad) which is as long as the message, with no repetitions. Key distribution is a problem Or, random key stream generation is a problem With such key, plaintext and ciphertext are statistically independent Unconditionally secure

Cryptography & Network Security

H. Yoon

Conventional Encryption: Classical Techniques

27

Classical Encryption Techniques

Transposition (Permutation) Techniques


Hide the message by rearranging the letter order without altering the actual letters used Rail Fence Cipher
Write message on alternate rows, and read off cipher row by row Example: M e m a t r h t g p r y MEMATRHTGPRYETEFETEOAAT e t e f e t e o a a t

Block (Columnar) Transposition Ciphers


Message is written in rectangle, row by row, but read off column by column; l The Th order d of f columns l read d off ff is i the th key k Example: Key: 4 3 1 2 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

Generalization: multiple transpositions


Cryptography & Network Security H. Yoon