210 likes | 577 Views
Classical Techniques: Substitution. Substitute a character, digit or symbol for each character in the plaintext Discussed: The Caesar cipher Monoalphabetic cipher Playfair cipher Polyalphabetic cipher. Caesar Cipher. 2000 years ago, by Julius Caesar
E N D
Classical Techniques: Substitution • Substitute a character, digit or symbol for each character in the plaintext • Discussed: • The Caesar cipher • Monoalphabetic cipher • Playfair cipher • Polyalphabetic cipher
Caesar Cipher • 2000 years ago, by Julius Caesar • A simple substitution cipher, known as Caesar cipher • Replace each letter with the letter standing 3 places further down the alphabet • Plain: meet me after the toga party • Cipher: PHHW PH DIWHU WKH WRJD SDUWB • No key, just one mapping (translation) 0123456... Plain: abcdefghijklmnopqrstuvwxyz Cipher: DEFGHIJKLMNOPQRSTUVWXYZABC 3456789... • ci=E(3,pi)=(pi+3) mod 26; pi=D(3,ci)=(ci-3) mod 26
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(k,pi)=(pi+k) mod 26; pi=D(k,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
Brute-Force Cryptanalysis of Caesar Cipher • Ciphertext only attack • Charateristics for success • The encryption and decryption algorithms are known • There are only 25 keys to try • The language of the plaintext is known and easily recongnizable
Monoalphabetic Cipher • Increased key space compared to Caesar cipher • Alphabet sequence is not required • What is the key space? • 26! > 4 x 1026 • Monoalphabetic ciphers are easier to break because they reflect frequency of alphabet • E = 12.75, T = 9.25, R = 8.50, N = 7.75, etc.
Substitution Techniques Frequency Statistics of Language • In addition to the frequency info of single letters, the frequency info of two-letter (digram) or three-letter (trigram) combinations can be used for the cryptanalysis • Most frequent digrams • TH, HE, IN, ER, AN, RE, ED, ON, ES, ST, EN, AT, TO, NT, HA, ND, OU, EA, NG, AS, OR, TI, IS, ET, IT, AR, TE, SE, HI, OF • Most frequent trigrams • THE, ING, AND, HER, ERE, ENT, THA, NTH, WAS, ETH, FOR, DTH
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 Cipher • Best-known multiple-letter substitution cipher • Digram cipher (digram to digram, i.e., E(pipi+1) = cici+1 through keyword-based 5x5 transformation table) • Great advance over simple monoalphabetic cipher (26 letters 26x26=676 digrams) • Can be generalized to polygram cipher Keyword = monarchy Plaintext: H S E A A R M U Ciphertext: B P I M R M C M
Playfair Cipher - Rules • Repeating plaintext letters are separated with a filler letter, such as X. • Plaintext letters that fall in the same row of the matrix are each replaced by the letter to the right, with the first element of the row circularly following the last. • Plaintext letters that fall in the same column are each replaced by the letter beneath, with the top element of the row circularly following the last. • Otherwise, each plaintext letter is replaced by the letter that lies in its own row and the column occupied by the other plaintext letter.
Polyalphabetic Cipher • Typically a set of monoalphabetic substitution rules is used • Key determines which rule to use
Vigenère cipher • Best-known polyalphabetic ciphers • Each key letter determines one of 26 Caesar (shift) ciphers • ci = E(pi) = pi + ki mod(key length) mod 26 • Example: • Keyword is repeated to make a key as long as the plaintext Key: deceptivedeceptivedeceptive Plaintext: wearediscoveredsaveyourself Cipheretxt: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Example: • Encryption • Decryption
Vigenère cipher - 3 • Vigenère autokey system: after key is exhausted, use plaintext for running key (to eliminate the periodic nature) Key: deceptivewearediscoveredsav Plaintext: wearediscoveredsaveyourself Cipheretxt: ZICVTWQNGKZEIIGASXSTSLVVWLA
M e m a t r h t g p r y e t e f e t e o a a t MEMATRHTGPRYETEFETEOAAT 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: • Block (Columnar) Transposition Ciphers • Message is written in rectangle, row by row, but read off column by column; The order of columns read off is the key • 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