Docsity

Cryptography: Shift, Substitution, and Vigenère Ciphers - Prof. Cristina Nita-Rotaru, Study notes of Cryptography and System Security

Partial preview of the text

Download Cryptography: Shift, Substitution, and Vigenère Ciphers - Prof. Cristina Nita-Rotaru and more Study notes Cryptography and System Security in PDF only on Docsity!

CS355: Cryptography

Lecture 3 & 4: Shift cipher,

substitution cipher,

Vigenere cipher.

Shift Cipher

 A substitution cipher

 The Key Space:

 [1 .. 25]

 Encryption given a key K:

 each letter in the plaintext P is

replaced with the K’th letter

following corresponding number

(shift right)

 Decryption given K:

 shift left

History: K = 3, Caesar’s cipher

Shift Cipher: Cryptanalysis

 Can an attacker find K?  YES: exhaustive search, key space is small (<= 26 possible keys).  Once K is found, very easy to decrypt

General Mono-alphabetical Substitution Cipher

 The key space: all permutations of Σ = {A, B, C, …, Z}

 Encryption given a key π:

 each letter X in the plaintext P is replaced with π(X)

 Decryption given a key π:

 each letter Y in the cipherext P is replaced with π

(Y)

Example:

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 A D C Z H W Y G O Q X S V T R N M S K J I P F E U

BECAUSE → AZDBJSZ

Cryptanalysis of Substitution Ciphers: Frequency Analysis  Basic ideas:  Each language has certain features: frequency of letters, or of groups of two or more letters.  Substitution ciphers preserve the language features.  Substitution ciphers are vulnerable to frequency analysis attacks.

Frequency of Letters in English

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 Series

 The number of different

ciphertext characters or

combinations are counted

to determine the frequency

of usage.

 The cipher text is examined for

patterns, repeated series, and

common combinations.

 Replace ciphertext characters with

possible plaintext equivalents using

known language characteristics.

Substitution Ciphers: Cryptanalysis

Frequency Analysis History

 Discovered by the Arabs  earliest known description of frequency analysis is in a book by the ninth-century scientist al-Kindi  Rediscovered or introduced from the Arabs in the Europe during the Renaissance  Frequency analysis made substitution cipher insecure

Summary

 Shift ciphers are easy to break using brute force attacks, they have small key space.  Substitution ciphers preserve language features and are vulnerable to frequency analysis attacks.

Towards the Polyalphabetic Substitution Ciphers  Main weaknesses of monoalphabetic substitution ciphers  each letter in the ciphertext corresponds to only one letter in the plaintext letter  Idea for a stronger cipher (1460’s by Alberti)  use more than one cipher alphabet, and switch between them when encrypting different letters  Developed into a practical cipher by Vigenère (published in 1586)

Security of Vigenere Cipher

 Vigenere masks the frequency with which a

character appears in a language: one letter in

the ciphertext corresponds to multiple letters in

the plaintext. Makes the use of frequency

analysis more difficult.

 Any message encrypted

by a Vigenere cipher is a

collection of as many shift ciphers as there

are letters in the key.

Vigenere Cipher: Cryptanalysis

 Find the length of the key.  Divide the message into that many shift cipher encryptions.  Use frequency analysis to solve the resulting shift ciphers.

Kasisky Test

 Note: two identical segments of plaintext, will be encrypted to the same ciphertext, if the they occur in the text at the distance Δ, (Δ≡0 (mod m), m is the key length).  Algorithm:  Search for pairs of identical segments of length at least 3  Record distances between the two segments: Δ1, Δ2, …  m divides gcd(Δ1, Δ2, …)

Example of the Kasisky Test

Key K I N G K I N G K I N G K I N G K I N G K I N G PT t h e s u n a n d t h e m a n i n t h e m o o n CT D P R Y E V N T N B U K W I A O X B U K W W B T