0% found this document useful (0 votes)
102 views37 pages

Symmetric Encryption

Symmetric encryption uses a shared secret key between the sender and receiver. It includes classical encryption algorithms like the Caesar cipher and Vigenère cipher. Cryptanalysis aims to recover the key from the ciphertext alone or with additional information like known or chosen plaintext. Methods include frequency analysis, brute force key searching, and identifying patterns from the encryption algorithm.

Uploaded by

jagmohan bisht
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views37 pages

Symmetric Encryption

Symmetric encryption uses a shared secret key between the sender and receiver. It includes classical encryption algorithms like the Caesar cipher and Vigenère cipher. Cryptanalysis aims to recover the key from the ciphertext alone or with additional information like known or chosen plaintext. Methods include frequency analysis, brute force key searching, and identifying patterns from the encryption algorithm.

Uploaded by

jagmohan bisht
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 37

Symmetric Encryption

• Or Conventional / Private-key / Single-key


• Sender and recipient share a common key
• All Classical Encryption Algorithms are Private-
key
• Was only type prior to invention of public-key
in 1970’s
• And by far most widely used
Some Basic Terminology
• Plaintext - original message
• Ciphertext - coded message
• Cipher - algorithm for transforming plaintext to
ciphertext
• Key - info used in cipher known only to sender/receiver
• Encipher (encrypt) - converting plaintext to ciphertext
• Decipher (decrypt) - recovering ciphertext from
plaintext
• Cryptography - study of encryption principles/methods
• Cryptanalysis (codebreaking) - study of principles/
methods of deciphering ciphertext without knowing
key
• Cryptology - field of both cryptography and cryptanalysis
Symmetric Cipher Model
Requirements
• Two requirements for secure use of
symmetric encryption:
– A strong encryption algorithm
– A secret key known only to sender / receiver
• Mathematically have:
Y = Ek(X)
X = Dk(Y)
• Assume encryption algorithm is known
• Implies a secure channel to distribute key
Cryptography
• Characterize cryptographic system by:
–Type of encryption operations used
• Substitution / transposition / product
–Number of keys used
• Single-key or private / two-key or public
–Way in which plaintext is processed
• Block / Stream
Cryptanalysis
• Objective to recover key not just
message
• General approaches:
–Cryptanalytic attack
–Brute-force attack
Cryptanalytic Attacks
• Ciphertext only
– Only know algorithm & ciphertext, is statistical, know or
can identify plaintext
• Known plaintext
– Know/suspect plaintext & ciphertext
• Chosen plaintext
– Select plaintext and obtain ciphertext
• Chosen ciphertext
– Select ciphertext and obtain plaintext
• Chosen text
– Select plaintext or ciphertext to en/decrypt
Brute Force Search
• Always possible to simply try every key
• Most basic attack, proportional to key size
• Assume either know / recognise plaintext
Key Size (bits) Number of Time required at 1 Time required at 106
Alternative Keys decryption/µs decryptions/µs
32 232 = 4.3  109 231 µs = 35.8 minutes 2.15 milliseconds
56 256 = 7.2  1016 255 µs = 1142 years 10.01 hours
128 2128 = 3.4  1038 2127 µs = 5.4  1024 years 5.4  1018 years

168 2168 = 3.7  1050 2167 µs = 5.9  1036 years 5.9  1030 years

26 characters 26! = 4  1026 2  1026 µs= 6.4  1012 6.4  106 years
(permutation) years
Classical Substitution Ciphers
• Where letters of plaintext are
replaced by other letters or by
numbers or symbols
• Or if plaintext is viewed as a
sequence of bits, then substitution
involves replacing plaintext bit
patterns with ciphertext bit patterns
Caesar Cipher
• Earliest known substitution cipher
• By Julius Caesar
• First attested use in military affairs
• Replaces each letter by 3rd letter on
• Example:
meet me after the toga
party
PHHW PH DIWHU WKH WRJD SDUWB
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 z
D 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 number


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
0 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

• Then have Caesar Cipher as:


c = E(p) = (p + k) mod (26)
Cryptanalysis of Caesar Cipher
• Only have 26 possible ciphers
– A maps to A,B,..Z
• Could simply try each in turn
• A brute force search
• Given ciphertext, just try all shifts of letters
• Do need to recognize when have plaintext
• e.g. break ciphertext "GCUA VQ DTGCM"
Monoalphabetic Cipher
• Rather than just shifting the alphabet
• Could shuffle (jumble) the letters arbitrarily
• Each plaintext letter maps to a different random
ciphertext letter
• Hence key is 26 letters long

Plain:
abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN

Plaintext:
ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Monoalphabetic Cipher Security
• Now have a total of 26! = 4 x 1026 keys
• With so many keys, might think is secure
• But would be !!!WRONG!!!
• Problem is language characteristics
Language Redundancy and Cryptanalysis

• Human languages are redundant


• e.g. "th lrd s m shphrd shll nt wnt"
• Letters are not equally commonly used
• In English E is by far the most common letter
– Followed by T,R,N,I,O,A,S
• Other letters like Z,J,K,Q,X are fairly rare
• Have tables of single, double & triple letter
frequencies for various languages
English Letter Frequencies
Use in Cryptanalysis
• Key concept - monoalphabetic substitution ciphers
do not change relative letter frequencies
• Discovered by Arabian scientists in 9th century
• Calculate letter frequencies for ciphertext
• Compare counts/plots against known values
• If Caesar cipher look for common peaks/troughs
– Peaks at: A-E-I triple, NO pair, RST triple
– Troughs at: JK, X-Z
• For monoalphabetic must identify each letter
– Tables of common double/triple letters help
Example Cryptanalysis
• Given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
• Count relative letter frequencies
• Guess P & Z are e and t
• Guess ZW is th and hence ZWP is the
• Proceeding with trial and error finally get:
it was disclosed yesterday that several
informal but direct contacts have been made
with political representatives of the viet
cong in moscow
Playfair Cipher
• Not even the large number of keys in a
monoalphabetic cipher provides security
• One approach to improving security was
to encrypt multiple letters
• The Playfair cipher is an example
• Invented by Charles Wheatstone in 1854,
but named after his friend Baron Playfair
Playfair Key Matrix
• A 5X5 matrix of letters based on a
keyword
• Fill in letters of keyword (sans duplicates)
• Fill rest of matrix with other letters
• e.g. Using the keyword MONARCHY
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
Encrypting and Decrypting
Plaintext is encrypted two letters at a time

1. If a pair is a repeated letter, insert filler like 'X’


2. If both letters fall in the same row, replace each
with letter to right (wrapping back to start from
end)
3. If both letters fall in the same column, replace
each with the letter below it (again wrapping to
top from bottom)
4. Otherwise each letter is replaced by the letter in
the same row and in the column of the other
letter of the pair
Security of Playfair Cipher
• Security much improved over monoalphabetic
• Since have 26 x 26 = 676 digrams
• Would need a 676 entry frequency table to
analyse (verses 26 for a monoalphabetic)
• And correspondingly more ciphertext
• Was widely used for many years
– e.g. By US & British military in WW1
• It can be broken, given a few hundred letters
• Since still has much of plaintext structure
Polyalphabetic Ciphers
• Polyalphabetic substitution ciphers
• Improve security using multiple cipher alphabets
• Make cryptanalysis harder with more alphabets to
guess and flatter frequency distribution
• Use a key to select which alphabet is used for each
letter of the message
• Use each alphabet in turn
• Repeat from start after end of key is reached
Vigenère Cipher
• Simplest polyalphabetic substitution cipher
• Effectively multiple Caesar ciphers
• Key is multiple letters long K = k1 k2 ... kd
• ith letter specifies ith alphabet to use
• Use each alphabet in turn
• Repeat from start after d letters in message
• Decryption simply works in reverse
Example of Vigenère Cipher
• Write the plaintext out
• Write the keyword repeated above it
• Use each key letter as a Caesar Cipher key
• Encrypt the corresponding plaintext letter
• e.g. using keyword deceptive
key:
de ce p t i v e d e c e p t i v e d e c e pt iv e
plaintext:
we ar e d i s c o v e r e d s a v e y o u rs el f
ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Security of Vigenère Ciphers
• Have multiple ciphertext letters for each
plaintext letter
• Hence letter frequencies are obscured
• But not totally lost
• Start with letter frequencies
– See if look monoalphabetic or not
• If not, then need to determine number of
alphabets, since then can attach each
Transposition Ciphers
• Now consider classical transposition or
permutation ciphers
• These hide the message by rearranging
the letter order
• Without altering the actual letters used
• Can recognise these since have the same
frequency distribution as the original text
Rail Fence cipher
• Write message letters out diagonally over
a number of rows
• Then read off cipher row by row
• e.g. write message out as:
m e m a t r h t g p r y
e t e f e t e o a a t
• Giving ciphertext
MEMATRHTGPRYETEFETEOAAT
Row Transposition Ciphers
• A more complex transposition
• 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 rows
Key: 3 4 2 1 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: TTNA – APTM – TSUO – AODW – COIX – KNLY
- PETZ
Steganography
• An alternative to encryption
• Hides existence of message
– Using only a subset of letters/words in a
longer message marked in some way
– Using invisible ink
– Hiding in LSB in graphic image or sound file
• Has drawbacks
– High overhead to hide relatively few info
bits
Steganography
Cryptanalysis
• Focus on cryptanalysis
• Hacker wants to recover key or plaintext
• Hacker is not bound by any rules
– For example, Hacker might attack the
implementation, not the algorithm itself
– Hacker might use “side channel” info, etc.
Exhaustive Key Search
• How can Hacker attack a cipher?
• Hacker can simply try all possible keys and
test each to see if it is correct
– Exhaustive key search
• To prevent an exhaustive key search, a
cryptosystem must have a large keyspace
– Must be too many keys for Hacker to try them all
in any reasonable amount of time
Beyond Exhaustive Search
• A large keyspace is necessary for security
• But a large keyspace is not sufficient
• Shortcut attacks might exist
• In cryptography we can (almost) never
prove that no shortcut attack exists
• This makes cryptography interesting…
Theoretical Cryptanalysis
• Suppose that a cipher has a 100 bit key
– Then key space is of size 2100
• On average, for exhaustive search Hacker
tests 2100/2 = 299 keys
• Suppose Hacker can test 230 keys/second
– Then Hacker can find the key in about 37.4
trillion years
Theoretical Cryptanalysis
• Suppose that a cipher has a 100 bit key
– Then keyspace is of size 2100
• Suppose there is a shortcut attack with “work”
equal to testing about 280 keys
• If hacker can test 230 per second
– Then hacker finds key in 36 million years
– Better than 37 trillion, but not practical
Applied Cryptanalysis
• In this class, we focus on attacks that
produce plaintext
– Not interested in attacks that just show a
theoretical weakness in a cipher
• We call this applied cryptanalysis
• Why applied cryptanalysis?
– Because it’s a lot more fun…
– And it’s a good place to start

You might also like