Cryptography and Network Security Chapter 2 – Classical Encryption Techniques
CLASSICAL ENCRYPTION TECHNIQUES .
-
Upload
leslie-long -
Category
Documents
-
view
227 -
download
0
Transcript of CLASSICAL ENCRYPTION TECHNIQUES .
CLASSICAL ENCRYPTION TECHNIQUES
www.applebuz.com
Encryption Techniques
• Symmetric Encryption - Substitution Cipher- Transposition Cipher
• Asymmetric Encryption- RSA Cipher
www.applebuz.com
Basic Terminology
Encryption: Process of encoding a message so that its meaning is not obvious.
Decryption: The reverse process of Encryption. Transforming an encrypted message into its normal, plaintext form.
Cryptosystem: A system for Encryption and Decryption.
• plaintext - the original message • cipher text - the coded message • cipher - algorithm for transforming plaintext to cipher text • key - info used in cipher known only to sender/receiverwww.applebuz.com
Symmetric Encryption
use the same (secret) key to encrypt and decrypt a message( i.e. sender and recipient share a common key ) All classical encryption algorithms are private-key
Symmetric Encryption also called as conventional / private-key / single-key Encryption Techniques
www.applebuz.com
Cryptanalysis
•Cryptanalysis is the process of trying to find the
plaintext or key
•Two main approaches
– Brute Force ( try all possible keys)
– Exploit weaknesses in the algorithm or key
( e.g. key generated from password entered by
user, where user can enter bad password )
www.applebuz.com
Cryptanalysis: Types of Attack
• Cipher text only– Just have cipher text to be decoded
• Known plaintext– Also have one or more plaintext-cipher text pairs
• Chosen plaintext– Cryptanalyst can choose plaintext and get corresponding Cipher text
• Chosen cipher text– Cryptanalyst can choose cipher text and get corresponding
plaintext• Chosen text
– Combination of chosen plaintext and chosen cipher text
www.applebuz.com
Cryptanalysis: Brute Force Attack
(Exhaustive Search)• Try all possible keys until code is broken• On average, need to try half of all possible keys• Infeasible if key length is sufficiently long
Key size No of Keys Time required at 1 Time required at 106 (bits) encryptions per ? s encryption per ? s32 4.3 x 109 36 minutes 2 milliseconds56 7.2 x 1016 1142 years 10 hours128 3.4 x 1038 5.4 x 1024 years 5.4 x 1018 years168 3.7 x 1050 5.9 x 1036 years 5.9 x 1030 yearsAge of universe: 1010 yearsNote: DES has a 56 bit key; AES key has 128+ bits
www.applebuz.com
Classical Encryption Techniques
Substitution techniquesThe letters of the message are replaced by other letters or by numbers or symbols.
Transposition techniquesPerforming some sort of permutation on the messages letters
www.applebuz.com
More Definitions
• unconditional security– 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. • computational security
– given limited computing resources (e.g. time needed for calculations is greater than age ofuniverse), the cipher cannot be broken
www.applebuz.com
Substitution Ciphers
• where letters of plaintext are replaced by other letters or by numbers or symbols• if plaintext is viewed as a sequence of bits, then substitution involves replacing plaintext bit
patterns with cipher text bit patterns
www.applebuz.com
Caesar Cipher
The caesar Cipher earliest known substitution cipher, developed by Julius Caesar
• First attested use in military affairs• Replaces each letter by 3rd letter.ExampleText : HELLO WORLDKey : Shift each ASCII character right by 3Encrypted text: KHOOR#ZRUOG To Decrypt : Shift each character left by 3
www.applebuz.com
Caesar Cipher
• can define transformation as: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 zD E F G H I J K L M N O P Q R S T U V W X Y Z A B C
• mathematically give each letter a numbera b c d e f g h i j k l m0 1 2 3 4 5 6 7 8 9 10 11 12 n o p q r s t u v w x y Z13 14 15 16 17 18 19 20 21 22 23 24 25
• then have Caesar cipher as:C = E(p) = (p + k) mod (26)p = D(C) = (C – k) mod (26)
www.applebuz.com
www.applebuz.com
Attacking Caesar Cipher
Brute force– Key is just one letter (or number between 1 and 25)
– Try all 25 keys
– Easy!
www.applebuz.com
One-Time Pad
• Unbreakable substitution cipher
• Uses random key that is as long as the message
• Can use key only once
www.applebuz.com
Mono alphabetic Cipher
• Use any permutation of the 26 alphabetic characters
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
q e r y u i o p a s d f g w h j k l z x c v b n m t
Example :
Plain text :under attack we need help
Cipher text :cwyul qxxqrd bu wuuy pufj
www.applebuz.com
Attacking Mono alphabetic substitution
Brute force– Very difficult; Key is 26 letters long– No. of possible keys = 26! = 4 x 1026
• Algorithm weaknesses:– Frequency of letters in English language is well known
• Can deduce plaintext->cipher text mapping by analyzing frequency of occurrence• e.g. on analyzing plenty of cipher text, most frequent letter probably corresponds to ‘E’
– Can spot diagrams and trigrams• Diagram: common 2-letter sequence; e.g. ‘th’, ‘an’, ‘ed’• Trigram: common 3-letter sequence: e.g. ‘ing’, ‘the’, ‘est’
www.applebuz.com
Frequency of Letters in English
3.54.25
12.75
3
2
3.5
7.75
0.25 0.5
3.75
2.75
7.75 7.5
2.75
0.5
8.5
6
3
0.5
2.25
0.25
9.25
1.251.51.5
7.75
0
2
4
6
8
10
12
14
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
www.applebuz.com
Poly alphabetic Cipher
• Using different mono alphabetic substitution
message: wearediscoveredsaveyourself
key: deceptivedeceptivedeceptiveCiphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
www.applebuz.com
Transposition Ciphers• Classical Transposition or permutation ciphers• These hide the message by re arranging the letter order without altering the actual letters used.• can recognize these since have the same frequency distribution as the original text
www.applebuz.com
Rail Fence cipher
• Write message letters out diagonally over a number of rows • Then read off cipher row by row• e.g.. Message : “ATTACK AT MIDNIGHT” write message out as:
A T C A M D I H T A K T I N G T
• Cipher text isATCAMDIHTAKTINGT
www.applebuz.com
Row Transposition Ciphers• A more complex scheme• write letters of message out in rows over a specified number of columns• Then reorder the columns according to some key before reading off the rowsKey word : NETWORKMessage : ATTACKISPOSTPONED
N E T W O R KKey : 3 1 6 7 4 5 2Plaintext : A T T A C K I
S P O S T P O N E D A B C D
Cipher text: TPEIODASNCTBKPCTODASA
www.applebuz.com
Product Ciphers
• Ciphers using substitutions or transpositions are not secure because of language characteristics
• Hence consider using several ciphers in succession to make harder, but:
– Two substitutions make a more complex substitution – Two transpositions make more complex transposition – But a substitution followed by a transposition
makes a new much harder cipher
• this is bridge from classical to modern ciphers