Lecture 5 - Symmetric Key Cryptography
Lecture 5 - Symmetric Key Cryptography
Lecture 5 - Symmetric Key Cryptography
Code: CS-16104
Branch: B.Tech - CS 6th Semester
Lecture – 5 : Symmetric-Key Ciphers – Part-2
• The first subkey is a predetermined value secretly agreed upon by Alice and Bob.
• The second subkey is the value of the first plaintext character (between 0 and 25).
• The third subkey is the value of the second plaintext. And so on.
Autokey Cipher
• However, it is still as vulnerable to the brute-force attack as the
additive cipher.
a. If the two letters in a pair are located in the same row of the secret key, the corresponding
encrypted character for each letter is the next letter to the right in the same row (with wrapping to
the beginning of the row if the plaintext letter is the last character in the row).
b. If the two letters in a pair are located in the same column of the secret key, the corresponding
encrypted character for each letter is the letter beneath it in the same column (with wrapping to the
beginning of the column if the plaintext letter is the last character in the column).
c. If the two letters in a pair are not in the same row or column of the secret, the corresponding
encrypted character for each letter is a letter that is in its own row but in the same column as the
other letter.
Playfair Cipher
When we group the letters in two-character pairs, we get “he, ll, o”.
We need to insert an x between the two l’s (els), giving “he, lx, lo”.
Cryptanalysis of a Playfair Cipher
• Obviously a brute-force attack on a Playfair cipher is very difficult.
• The size of the key domain is 25!
• However, the frequencies of diagrams are preserved (to some extent
because of filler insertion), so a cryptanalyst can use a ciphertext-only
attack based on the digram frequency test to find the key.
One-Time Pad
• One of the goals of cryptography is perfect secrecy.
• A study by Shannon has shown that perfect secrecy can be achieved if each
plaintext symbol is encrypted with a key randomly chosen from a key domain.
• For example, an additive cipher can be easily broken because the same key is used
to encrypt every character.
• However, even this simple cipher can become a perfect cipher if the key that is
used to encrypt each character is chosen randomly from the key domain (00, 01,
02, …, 25) - that is, if the first character is encrypted using the key 04, the second
character is encrypted using the key 02, the third character is encrypted using the
key 21; and so on.
• This idea is used in a cipher called one-time pad, invented by Vernam.
• In this cipher, the key has the same length as the plaintext and is chosen
completely in random.
One-Time Pad
• A one-time pad is a perfect cipher, but it is almost impossible to
implement commercially.
• If the key must be newly generated each time, how can Alice tell Bob
the new key each time she has a message to send?
• However, there are some occasions when a one-time pad can be used.
• For example, if the president of a country needs to send a completely
secret message to the president of another country, she can send a
trusted envoy with the random key before sending the message.
TRANSPOSITION CIPHERS
• She then creates the ciphertext “MEMATEAKETETHPR” by sending the first row followed by the
second row.
• Bob receives the ciphertext and divides it in half (in this case the second half has one less
character).
• The first half forms the first row; the second half, the second row. Bob reads the result in zigzag.
Keyless Transposition Ciphers
Transposition cipher
• Alice and Bob can agree on the number of columns
and use the second method.
• Alice writes the same plaintext, row by row, in a table
of four columns.
• She then creates the ciphertext
“MMTAEEHREAEKTTP” by transmitting the
characters column by column.
• Bob receives the ciphertext and follows the reverse
process.
• He writes the received message, column by column,
and reads it row by row as the plaintext.
Keyless Transposition Ciphers
Transposition cipher
• The following figure shows the permutation of each character in the plaintext into
the ciphertext based on the positions.
• The second character in the plaintext has moved to the fifth position in
the ciphertext;
• The third character has moved to the ninth position; and so on.
• Although the characters are permuted, there is a pattern in the
permutation: (01, 05, 09, 13), (02, 06, 10, 13), (03, 07, 11, 15), and
(08,12).
• In each section, the difference between the two adjacent numbers is 4.
Keyed Transposition Ciphers
• The key used for encryption and decryption is a permutation key, which shows how the
character are permuted.
• For this message, assume that Alice and Bob used the following key
Keyed Transposition Ciphers
• The third character in the plaintext block becomes the first character in the
ciphertext block;
• The first character in the plaintext block becomes the second character in
the ciphertext block; and so on.
• The permutation yields
• Additive ciphers
• Monoalphabetic substitution • Playfair ciphers
ciphers • Polyalphabetic cipher
• Vigenere ciphers • DES and AES