Sei sulla pagina 1di 10

Substitution Ciphers Technique

In the Substitution Technique, The characters of the Plain Text message are replaced by others Characters by using any algorithm to create the Cipher Text. These Characters can be any of three: - Alphabets, Numbers or Symbols. Various Substitution Cipher Technique are given following. 1 2 3 4 5 6 Casear Cipher Mono-alphabetic Cipher Poly-alphabetic cipher Homophonic Cipher Polygram Cipher Polyfair Cipher

1. Caesar Cipher / Shift Cipher


This is the first and simplest Substitution Cipher. It is proposed by Julius Caesar so it is known as Caesar Cipher. Caesar Cipher is a special case of substitution technique wherein Each Alphabet in any message is Replaced by the Alphabet; which is Three Place Down the Line
A D B E C F D G E H F I G J H K I L J M K N L O M P N Q O R P S Q T R U S V T W U X V Y W Z X A Y B Z C

Replacement Table for Encryption Here Characters shifts by key of 3, so it is also called as Shift Cipher. In a Modified version of Caesar cipher Key can be any number from 1 to 25 because we know the English alphabet have the 26 alphabets only. So 26th shift is comes remain same as Plain Text. Due to this there are total 25 possibilities are comes out for encryption.

Example
Example for Encrypt the Massage A B C D D E F G F G H I J K J K M N M N P Q P Q R S T S T U V W W X Z A Z C

Here Encrypt Key is 3


Plain Text I Cipher Text L O V E Y O U

Example for Decrypt the Massage (Simply Change the Row of Replacement Table for Decryption) D E F G A B C D I J K F G H M N J K P Q M N S T U V W P Q R S T Z A W X C Z

Here Decrypt Key is 3


Cipher Text L Plain Text O R Y H B R X

Encryption Algorithm for Caesar Cipher


1. Create the Replacement Table by using Shift Key. 2. Read the alphabet in the Plain Text massage, and search column wise corresponding alphabet in the second row of the replacement Table. (I.e. Second Row of the Table). 3. When a match found, replace that alphabet in cipher text message with the corresponding alphabet in the same column. (e.g. I replace with L & L Replace with O and so on..) 4. Repeat the process for all alphabets of Plain text to generate the Cipher text.

Decryption Algorithm for Caesar Cipher


1 2 Create the Replacement Table by using Shift Key. (Simply Change the row of Encrypt Replacement table) Steps 2-4 are same as the encryption algorithm.

Note: Cryptanalyst is a unknown person who want to break a cipher text to obtain the original Plain text massage by illegal authority. And the process is called as cryptanalysis.

2. Mono-alphabetic Cipher
As we know there is only 25 Possible keys present in Caesar Cipher. Thus any cryptanalyst has the ability to get original massage by 25 possible attacks and he is assured of success. Due to the Major weakness in Caesar Cipher, we are decided to use Random substitution. In Mono-alphabetic Cipher, a Character (or a symbol) in plaintext is always changed to the Specified character to create the Cipher text. Keep in mind the positions of character are not changed, only substitute the desired character. There exists one-to-one relationship.

For example if the Algorithm says the Character A in the plaintext changed to D. then every character A should be changed to character D. This means that Each A can be replaced by any other alphabet (B to Z). & Each B can be replaced by any other alphabet (A or C to Z) and so on.

Plain Text H E L L O Cipher Text Here Both occurrence of Ls are encrypted by Os so it is Mono-alphabetic Cipher. To put it mathematically We have total possibilities 26! = (26x25x24x23x..x1) = 403291461126605635584000000 (27 digits) . This is extremely hard to crack. Thus a Mono-alphabetic cipher creates a difficult problem for a cryptanalyst to break the code. Because it is impossible to check all the possibilities.

3. Poly-alphabetic Cipher
Invented in 1568. In Poly-alphabetic Cipher, each character can have a different substitute. This Cipher uses multiple one-character keys. So there exists one-to-Many relationship. Each of key encrypts one plain text character. i.e. the first key encrypt the first character, Second key encrypts the second character and so on. Main Features A) It uses a set of related mono-alphabetic substitution rules.

B) And a key that determines which rule is used for which transformation. - To understand this technique, we need to look a table which is formally known Vigenere table. A) There is a table of 26 Row x 27 Column. B) 1st column is used for the key for 1st character, 2nd character, Plain Text H E L and 3rd character of Plain text and so on. C) Now start with 1st Row and 2nd column. Key Example for understand Cipher Text Position of Character 1st char. of MSG. 2 char. of MSG. 3 char. of MSG. 4 char. of MSG. 5 char. of MSG.
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 26
th th rd nd

L O

Char. of Plain Text (ROW)

Char. Given Key (Column)

Corresponding Char. of Cipher Text Corr. Char of H & O ------V Corr. Char of E & F -------I Corr. Char of L & A -------J Corr. Char of L & B -------J Corr. Char of O & K ------U A A A A A A A A A B C D E F G H I J K L B C D E F G H I J K L M B C D E F G H I J K L B C D E F G H I J K L B C D E F G H I J K L B C D E F G H I J K L B C D E F G H I J K L B C D E F G H I J K L M

H from 1 Row E from 2nd Row L from 3rd Row L from 4th Row O from 5th Row
st

O from 1 column F from 1st column A from 1st column B from 1st column K from 1st column
st

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 A A A A A A A A A A A A A A B B C B C D B C D E B C D E F B C D E F G B C D E F G H B C D E F G H I B C D E F G H I J B C D E F G H I J K B C D E F G H I J K L B C D E F G H I J K L B C D E F G H I J K L B C D E F G H I J K L B C D E F G H I J K L

B C D E F G H I J K L

M N O P Q R S T U V W

M N O P Q R S T U V

M N O P Q R S T U V

M N O P Q R S T U V

M N N O P Q R S T O P Q R S T U

M N O P Q R S

M N O P Q R

M N O P Q

M N O P

M N O

W X Y

M N

W X

4. Homophonic Substitution Cipher


1It is very similar to Mono-alphabetic Cipher. It involves substitution of one Plain text character with a cipher text character at a time. However the cipher text character can be any one of the chosen set. Like a Plain substitution Cipher technique, we replace one alphabet with another. The difference btw. Mono-alphabetic and Homophonic is that the replacement alphabet set in Monoalphabetic substitution technique is fixed. Whereas in homophonic it is not fixed set. Example- Replace A with D, B with E, etc. in Simple Cipher technique.
A D B E C F D G E H F I G J H K I L J M K N L O M P N Q O R P S Q T R U S V T W U X V Y W Z X A Y B Z C

But in case of Homophonic substitution Cipher, one alphabet of plain text can map more than one alphabet of cipher text. Example- A can be replace by D, H, P, R etc. B can be replace by E, I, Q, S etc. as per given specifications.

5. Polygram Substitution Cipher


Rather than replacing one alphabet of Plain text with one alphabet of cipher text, a block of alphabets is replaced by with another block. For instance HELLO could be replaced by YUQQW But HELL could replace by a totally different cipher text block TEUI In Polygram substitution cipher, the replacement of plain text happens block by block, rather than character by character. It does not work on a character by character basis. It works on a block by block basis. It is also known as Polyfair Square, It is cryptography technique that is used for manual encryption of data. Playfair is quite fast to use and does not demand any special hardware to be used. It was use to protect important but not very critical information. If any cryptanalyst could break it, the value of the information was nullified anyway! Today, Playfair is outdated algorithm. Now Playfair has only academic purpose and in some crossword that appear in newspaper. Playfair uses two main process 1) STEP 1: Creation and population of matrix 2) STEP 2: Encryption process

6. Playfair Cipher / Playfair Square

STEP 1: Creation and population of matrix - Playfair cipher use of 5x5 matrix, which is used to store the keyword. - That becomes the key for Encryption & Decryption. - Enter the keyword in the matrix Row-wise: left to right, and then top-to-bottom. - Ignore the same characters. - Fill the remaining spaces in the matrix with the rest of the English alphabets (A-Z), if I or J is the part of our keyword, disregard both the I and J while filling the remaining slots. For Example P L A Y F Suppose given keyword is PLAYFAIR EXAMPLE. I R E X M Rewrite the keyword ignoring same character PLAYF IREXM. Put these latters B C D G H in 5x5 matrix. K N O Q S Now fill remaining spaces with A-Z without repeating words. T U V W X

STEP 2: Encryption Process - 1). The Plaintext that we want to encrypt needs to be broken down in to groups of two alphabets. For example if our plaintext is MY NAME IS ATUL, it becomes MY NA ME IS AT UL. - 2). If both the alphabets are same (or only one is left in last), add an X after first alphabet. - 3). If both the alphabets in the pair appear in same row of matrix, replace them with alphabets to their immediate right respectively. - 4). If both the alphabets in the pair appear in same column of our matrix, replace them with alphabets to their below them respectively. - 5). If the alphabets are not in same row or column, replace them with alphabets in the same row respectively. But at the other pair of corners of the rectangle defined by the original pair. The first encrypted alphabet of the pair is one that is present in the same row of first plaintext alphabet. For Example Suppose given keyword is PLAYFAIR EXAMPLE. And original massage is MY NAME IS ATUL 1. Break original massage in to two alphabets. MY NAME IS ATUL----------- MY NA ME IS AT UL

2. Now use the 5x5 matrix of keyword PLAYFAIR EXAMPLE. In above step our 1 st pair of alphabets is MY. Looking in matrix, alphabet M & Y do not occur in the same row or column. Now we need to apply step 5. Now first encrypted pair for MY is XF

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

3. Our next pair is NA Now second encrypted pair for NA is - OL

P I B K T

L R C N U

A E D O V

Y X G Q W

F M H S X

4. Our next pair is ME Based on logic of step 3. Now Third encrypted pair for ME is - IX

P I B K T P I B K T

L R C N U L R C N U

A E D O V A E D O V

Y X G Q W Y X G Q W

F M H S X F M H S X

5. Next pair is - IS Now fourth encrypted pair for IS is MK

6. Next pair is AT Now Fifth encrypted pair for AT is PV

P I B K T

L R C N U

A E D O V

Y X G Q W

F M H S X

7. Next pair is UL Use the step 4. Now the Sixth & last encrypted pair for UL is LR

P I B K T

L R C N U

A E D O V

Y X G Q W

F M H S X

Finally the cipher text becomes XF OL IX MK PV LR

7. Hill Cipher
Hill Cipher has its roots in matrix theory. Understand by Example We have Plaintext CAT and now we are encrypting it by using Hill Cipher Substitution technique. 1. Treat all character as a number. So that A=0, B=1, C=2,, Z=25 2. Organize a matrix by using plaintext. Here Plaintext is CAT. So that C=2, A=0, T=19. This is known as Plaintext Matrix. ( )

3. Chose a random key matrix. This key matrix consists of size nxn order. ( )

4. Multiply both the Matrix (i.e. Key Matrix & Plaintext Matrix). ( ) ( ) ( )

5. Now compute a mod 26 value of the above resultant matrix. That is, take reminder after dividing the above matrix values by 26. That is: ( 6. 7. 8. 9. ) ( )

31/26 = 1 with reminder 5 which goes in above matrix and so on. Translating number in to alphabet. i.e. 5=F, 8=I, and 13=N Our Cipher text is FIN For Decryption: Multiply the cipher text matrix & Inverse of Key Matrix. ( ) ( ) ( )

Transposition Ciphers Technique


In the Transposition Technique, There is no any substitution of characters; instead their position change. A character in 1st position of Plaintext may appear in the 10th position of the cipher text. A character in 1st position of Plaintext may appear in the 10th position of the cipher text. A transposition cipher reorders characters in a block of symbols. There are Various Transposition cipher techniques given following: 1 2 3 4 5 6 7 8 Rail Fence Technique Simple Columnar Technique Vernam Cipher Book Cipher XOR Cipher Rotation cipher Data Encryption Standard (DES) Advanced Encryption Standard (AES)

8. Rail Fence Technique


Rail Fence technique involves writing plain text message as a sequence of diagonals and then reading it row-by-row to produce cipher text. Encryption Algorithm:1. Write down the plain text message as a sequence of diagonals. 2. Read the Plain text Row-by-Row and write down left to right then top to bottom. Example Original Plain text massage: Come Home Tomorrow. 1. After we arrange the plaintext message as a sequence of diagonals, it look like follows
C O M E H O M E T O M O R R O W

2. Now read the text row-by-row, and write it sequentially. Thus we have: CMHMTMROOEOEOORW as the cipher text.

9. Simple Columnar Transposition Technique


Simple columnar transposition technique simply arranges the plaintext as a sequence of rows of a rectangle that are read in columns randomly. 1. Write the plain text message row-by-row in a rectangle of a pre-defined size. 2. Read the message column-by-column. However it need not be in order of columns 1, 2, 3 etc. it can be in any order such as 2, 3, 1 etc. 3. The message thus obtained is the cipher text message. Example Original Plain text massage: Come Home Tomorrow. 1. Let us consider a rectangle with six columns. Therefore, when we write the message in the rectangle row-by-row suppressing spaces. Column 1 Column 2 Column 3 Column 4 Column 5 Column 6 C M R O E R M T O E O W H M O O

2. Now, let us decide the order of columns as some random order, say 4, 6, 1, 2, 5 & 3. Then read the text in the order of these columns. 3. The cipher text thus obtained would be EOWOOCMROEHMMTO.

Simple Columnar Transposition Technique with multiple Rounds


To improve the basic simple columnar, we can introduce more complexity. Use the same basic operation of simple columnar technique, but do it more than once. Algorithm: 1. Write the plain text message row-by-row in a rectangle of a pre-defined size. 2. Read the message column-by-column. However, it need not to be in order of column 1, 2, 3 etc. it can be any random order such as 2, 3, 1 etc. 3. The message thus obtained is the cipher text message of round 1. 4. Repeat steps 1to 3 as many times as desired.

10.Vernam Cipher (One - time pad)


It is implemented using a random set of non repeating characters as the input cipher text. Main point is that once an input cipher text for transposition is used, it is never used again for any other message. So it is called One-Time. Length of the input cipher text is equal to the length of the original plain text. Algorithm 1. Translate each plain text alphabet in to corresponding Number (i.e. A=0, B=1,,Z=25). 2. Do the same for each character input cipher text. 3. Add each number corresponding to the plain text alphabet to the corresponding input cipher text alphabet number. 4. If the sum thus produced is greater than 26, subtract 26 from it. 5. Translate each number of the sum back to the corresponding alphabet. This gives the output cipher text. Example:Plain text message HOW ARE YOU One-time pad - NCBTZQARX H O W A R E Y O U 1. Plain Text 7 14 22 0 17 4 24 14 20 N C B T Z Q A R X 2. One-time pad 13 2 1 19 25 16 0 17 23 3. Initial Total 20 16 23 19 42 20 24 31 43 4. Subtract 26, if >25 20 16 23 19 16 20 24 5 17 5. Cipher text U Q X T Q U Y F R 6. One-time pad is discarded after a single use. 7. This technique is highly secure and suitable for small plain text message. 8. It is clearly impractical for large messages. It is quite simple and similar to Vernam Cipher. For producing the cipher text, some portion of text from a book is used. This serves the purpose of one-time pad. Thus character from a book is used as one-time pad and they added to input plaintext message. It uses the exclusive-or operation. An XOR operation needs two data inputs: Plaintext as the First input

11. Book Cipher / Running key Cipher


-

12.XOR Cipher

A key as the Second input In other words one of the inputs is the block to be encrypted, the other input is a key; result is the encrypted block. Size of plaintext, key & cipher text is all the same.

13.Rotation Cipher
It is another common cipher. In Rotation cipher; input bits are rotated to left or right Rotation cipher can be keyed or keyless In keyed rotation: Value of key defines the number of rotations. In keyless rotation: The numbers of rotations are fixed. Rotation cipher using the bits instead of characters. If the length of original stream is N. then after N rotations, we get the original input stream.

14.Data Encryption Standard (DES)


DES is a complex block cipher. And it was designed by IBM. Adopted by the U.S. government in 1977. Data Encryption Standard (DES) also called as Data Encryption Algorithm (DEA). Same algorithm used for encryption and Decryption with minor differences. It is generally used in ECB, CBC, or the CFB mode. DES has Two transposition blocks (P-Boxes) And 16 complex Round Ciphers, which are repeated. Although the 16 iteration rounds are same, but each uses a different key derived from the original key. The initial & final permutations are keyless straight permutation & inverse to each other.

DES Function Heart of the DES is the DES Function. The DES Function applies a 48-bit key to the rightmost 32 bits Ri to produce 32-bit output. This function made up of four operations: XOR Expansion Permutation Group of S-boxes. Straight Permutation

How DES Works It encrypts the data of 64 bit plaintext using key length of 56 bit (i.e. 64 bit plaintext goes to the input of DES, which produce the 64 bit cipher text). We have mentioned that DES uses the 56-bit key; actually the initial key consists of 64 bits. However, Before the DES process even starts, every 8th bit of the key is discarded to produce 56-bit key. That is, positions 8, 16, 24, 32, 40, 48, 56, 64 (total 8 bits). i.e. 64-8 =56 bit key. 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 Discarding of every 8th bit of original key DES is based on two fundamental attributes : 1. Substitution (also called confusion) 2. Transposition (also called diffusion) DES consists of 16 steps, each of which is called as a round. Each round performs the steps of substitution & transposition.

Broad-level Steps 1. First step the 64 bit plaintext block is handed over to an initial Permutation (IP) function. 2. The initial permutation is performed on plaintext. 3. Next, IP produces two halves of permuted block; LPT & RPT (left Plain text & Right Plain text). 4. Now, each of LPT and RPT go through 16 rounds of encryption process. 5. In the end, LPT & RPT rejoined and a Final permutation is performed on combined block. 6. The result of this process produces 64-bit cipher text.

Potrebbero piacerti anche