<<

Computing Security 1 Lecture 6

Lecture 6 overview: ▪Classical Techniques ▪ Transposition Techniques • Message Reversal Method • Columns Transposition) Method ▪ Substitution Techniques • Caesar & Multiplication Cipher • Vigenere Cipher • Beale Cipher • PlayFair Cipher ▪Classical

18. Classical Encryption Techniques Classical (Traditional or Conventional) ciphers have been used since ancient Egypt. Different methods and techniques are used in order to increase security level of such information. Some facts about classical : • All of these systems are based on symmetric encryption scheme. • The only security service these systems provide is confidentiality of information. • Unlike modern systems which are digital and treat data as binary numbers, the earlier systems worked on alphabets as basic element. • Most of classical methods and techniques are based on the idea that each natural language has its own distribution characteristics. However, there are two schemes or types of classical cryptosystems: 1- Transposition(Permutation) Techniques. 2- Substitution Techniques.

Page 1

Computing Security 1 Lecture 6

18.1 Transposition Techniques Transposition ciphers rearrange characters according to some scheme (procedure). There are many transposition procedures; some of these have different methods. However, we will explain the following methods only: ▪ Message Reversal Method This procedure requires that the plain text to be written backwards to produce a cipher text. Example: Plain text : COMPUTER SCIENCE Cipher text : ECNEICS RETUPMOC ▪ Columns Transposition Method: This method belongs to Geometric Patterns Scheme that base on divided the message to number of line has the columns of equal length (i.e., each line has number of letters change dynamic base on key) by writing the plaintext vertically: Example: let, the plain text: COMPUTER AND DATA SECURITY, and Key = 4 1 5 3 2

C O M P U P C U M O T E R A N A T N R E D D A T A T D A A D U S R C E S E C U R X I X Y T I T Y X X Cipher text: PCUMO ATNRE TDAAD USRCE XIXYT 18.2 Substitution Techniques Four basic types of classical cryptosystems based on Substitution are: ✓ Simple Substitution (e.g. and Decimation Cipher) ✓ Polyalphabetic Substitution (e.g. Vigenere Cipher). ✓ Homophonic Substitution (e.g. Beale Cipher). ✓ Polygram Substitution (PlayFair Cipher). Page 2

Computing Security 1 Lecture 6

▪ Caesar Cipher Caesar Cipher (or Shifted alphabet) is one of simple substitution (or monoalphabetic) ciphers, each character of the plaintext is replaced with a corresponding character of . A single one-to-one mapping function (ƒ) from plaintext to ciphertext character is used to encrypt the entire message using the same key (k); such that : f(mi) = (mi + k) mod n Where k is the number of positions to be shifted, mi is a single character of the alphabet, and n is the size of the alphabet. Example: If k = 3 then we can encrypt the following message as: M : C O M P U T E R

Ek(M): F R P S X W H U ▪ Decimation (or Multiplication) Cipher f(mi) = mi * k mod n Where k and n are relatively prime in order to produce a complete set of residues. Relatively prime means that the greater common divisor (gcd) between k and n equal to one (i.e. gcd (k,n)=1) Example: k = 9; then the message (ABCD) can encrypt as: M : A B C D

Ek(M) : I R A J If k and n are not prime, several letters will encipher to the same ciphertext letter, and not all letters will appear in the ciphertext. Home work1: try it when k = 13

Page 3

Computing Security 1 Lecture 6

▪ Vigenere Cipher A means a sequence of monoalphabetic ciphers, which are often referred to as its substitution alphabets or just alphabet. In another meaning; it is made of multiple simple substitutions. The sequence of the substituting alphabet may have fixed length (d) and is denoted as its period.

Ek(M)=f1(m1),…,fd(md) , f1(md+1),….,fd(m2d) For d=1 ,the cipher is monoalphabetic. Vigenere cipher is a popular form of Polyalphabetic (or periodic) substitution ciphers. The key is specified by a sequence of letters, K= k1,k2,…,kd , then Vigenere cipher system is defined as: fi (mi) = (mi +kj) mod n for j=1,2, ...., d Example:let M= CODEBREAKING and K=RADIO. . M: C O D E B R E A K I N G K: R A D I O R A D I O R A C: U P H N Q J F E T X F H ▪ Beale Cipher Homophonic substitution ciphers maps each character (a) of the plaintext alphabet into a set of ciphertext elements f(a) called homophone. Beale is example of homophonic ciphers. Example: English letters are enciphered as integers (0 - 99), a group of integers are assigned to a letter proportional to the relative frequency of the letter, as follows:

Page 4

Computing Security 1 Lecture 6

Letter Homophones A 17 19 34 4 56 60 67 83 I 08 22 53 65 88 90 L 03 44 76

N 02 09 15 27 32 40 59

0 01 11 23 28 42 54 70 80

P 33 91

M= PT L A I 05 N 10 P20 29 I 45L 58 640 78T 99

C= 91 44 56 65 59 33 08 76 28 78 Homophonic substitution ciphers are more complicated than simple substitution ciphers, but still do not obscure all of the statistical properties of the plaintext language. ▪ PlayFair Cipher Polygram cipher systems are ciphers in which group of letters are encrypted together, and includes enciphering large blocks of letters. Therefore, permits arbitrary substitution for groups of characters. For example the plaintext group "ABC" could be encrypted to "RTQ", "ABB" could be encrypted to "SLL", and so on. Playfair is examples of such ciphers. Playfair cipher is a diagram , the key is given by a 5*5 matrix of 25 letters ( j was not used ), as described in figure 2-3. Each pair of plaintext letters are encrypted according to the following rules: 1. If m1 and m2 are in the same row, then c1 and c2 are to the right of m1 and m2, respectively. The first column is considered to the right of the last column. 2. If m1 and m2 are in the same column, then c1 and c2 are below m1 and m2 respectively. The first row is considered to be below the last row. Page 5

Computing Security 1 Lecture 6

3. f m1 and m2 are in different rows and columns, then c1 and c2 are the other two corners of the rectangle. 4. If m1=m2 a null letter is inserted into the plaintext between m1 and m2 to eliminate the double. 5. If the plaintext has an odd number of characters, a null letter is appended to the end of the plaintext.

H A R P S I C O D B E F G K L M N Q T U V W X Y Z

Key for Playfair cipher Example: M = RE NA IS SA NC EX Ek(M) = HG WC BH HR WF GV

19. Classical Ciphers Cryptanalysis Most of cryptanalysis methods make use of the statistical properties of the natural languages. Among these properties is the letter frequency distribution, which gives the percentage frequency of the characters in the given text. Another property of natural language is the frequency of pairs and triples of letters in the target language. After encryption, some information will remain in the cipher text, especially for simple cipher systems. Cryptanalysis will rely heavily on such information to analyze the cipher text. This knowledge is quite sufficient for simple substitution and monoalphabetic ciphers, because the cipher text alphabet is a rotation of the plaintext alphabet and not an arbitrary permutation. Therefore, the statistical information unchanged during Page 6

Computing Security 1 Lecture 6 the encryption process. Homophonic substitution ciphers do not obscure all of the statistical properties of the plaintext; hence it is slightly harder than simple substitution ciphers to break. In polyalphabetic ciphers, if the key length (period) is equal to one (d=1), then polyalphabetic ciphers become monoalphabetic (simple substitution), and hence, it is as easy as its equivalent to break. However, as period increased, it becomes harder and harder. To solve a periodic substitution cipher, the cryptanalyst must determine the period of the cipher. Two earlier methods of classical ciphers cryptanalysis have been used, (IC), and Kasiski method, which help to determine the period. 19.1 Statistical Cryptanalysis. All natural languages have statistical characteristics, which mean that each character in the alphabet has its own frequency in any text of 1000 characters or more. Since these frequencies are so consistent, then an approximate probability can be attached to letter. For example, p(e) is much greater than every other probability, we would deduce that the most significant letter in a monoalphabetic cipher is equivalent for (e). However, English characters can be grouped into five sets according to their frequencies: group letters frequency I e 9.614 II t , a ,o , i ,n , s , h, r 6.855 - 4.532 III d , l 3.219 - 3.047 IV c, u , m , w , f, g , y , p , b 2.106 - 1.129 V v, k , j , x , q , z 0.741 - 0.056 Digrams, trigrams, also have consistent frequencies. 19.2 Index of Coincidence. Index of coincidence measures the variation in the frequencies of the letters in ciphertext. If the period of cipher is one (1), then it means that a

Page 7

Computing Security 1 Lecture 6 simple substitution cipher has been used, and there will be a considerable variation in the letter frequencies, and the index of coincidence (IC) will be high. As the period (d) is increased, the variation gradually eliminated due to diffusion, and the IC will be low. IC is defined by the following formula:

IC =

Where Fi : is the frequency of the ith letter in the cipher text. N : is the length of cipher text. n: is the number of alphabet. Once IC is calculated, the period d can be estimated using the following formula: exp( IC) = (N-d)/ d(n-1) (0.066) + N(d-1)/d(N-1) (0.038) IC is developed from the message which ranges from flat distribution (infinite period) to 0.066 for English cipher with period 1.Thus IC varying from 0.038 for an infinite period to 0.066 for a period of 1 .as shown in table (1) Table (1): Expected index of coincidence. Period (d) IC 1 0.066 2 0.052 3 0.047 4 0.045 5 0.044 10 0.041 Large 0.038

To estimate the period of a given cipher, measure the frequencies of letters in the ciphertext, compute IC, and finally compare this with expected values shown in table (1). Page 8

Computing Security 1 Lecture 6

19.3 Kasiski Method. Kasiski method uses repetition in the ciphertext to give clues to the cryptanalyst of the period. IC method analyzes repetitions in the ciphertext to determine the exact period. Repetitions occur in the ciphertext when a plaintext pattern repeats at a distance equal to a multiple of the key length.

Page 9