Cryptography and Network Security: Edition by William Stallings
Cryptography and Network Security: Edition by William Stallings
Cryptography and Network Security: Edition by William Stallings
Network Security
Edition
by William Stallings
Chapter 2
Classical Encryption
Techniques
"I am fairly familiar with all the forms of secret
writings, and am myself the author of a trifling
monograph upon the subject, in which I analyze
one hundred and sixty separate ciphers," said
Holmes.
Symmetric,
single-key, secret-
Substitution Block cipher
key, conventional
encryption
Asymmetric, two-
Transposition key, or public-key Stream cipher
encryption
Cryptanalysis and
Brute-Force Attack
• Computationally secure
• The cost of breaking the cipher exceeds the
value of the encrypted information
• The time required to break the cipher
exceeds the useful lifetime of the
information
Brute-Force Attack
• A shift may be of any amount, so that the general Caesar algorithm is:
C = E(k , p ) = (p + k ) mod 26
p = D(k , C ) = (C - k ) mod 26
Brute-Force
Cryptanalysis of
Caesar Cipher
• Trigram
• Three-letter combination
• Most frequent is the
Playfair Cipher
• Best-known multiple-letter encryption cipher
• Treats digrams in the plaintext as single units and
translates these units into ciphertext digrams
• Based on the use of a 5 x 5 matrix of letters
constructed using a keyword
• Invented by British scientist Sir Charles
Wheatstone in 1854
• Used as the standard field system by the British
Army in World War I and the U.S. Army and other
Allied forces during World War II
Playfair Key Matrix
Fill in letters of keyword (minus duplicates) from
left to right and from top to bottom, then fill in
the remainder of the matrix with the remaining
letters in alphabetic order
We must now split the plaintext up into digraphs (that is pairs of letters). On
• Using the keyword MONARCHY: each digraph we perform the following encryption steps:
• If the digraph consists of the same letter twice (or there is only one letter
left by itself at the end of the plaintext) then insert the letter "X" between
M O N A R the same letters (or at the end), and then continue with the rest of the
steps.
C H Y B D • If the two letters appear on the same row in the square, then replace each
letter by the letter immediately to the right of it in the square (cycling round
E F G I/J K to the left hand side if necessary).
• If the two letters appear in the same column in the square, then replace
L P Q S T each letter by the letter immediately below it in the square (cycling round to
U V W X Z the top of the square if necessary).
• Otherwise, form the rectangle for which the two plaintext letters are two
opposit corners. Then replace each plaintext letter with the letter that forms
the other corner of the rectangle that lies on the same row as that plaintext
letter (being careful to maintain the order)
Hill Cipher
• Developed by the mathematician Lester Hill in
1929
• Strength is that it completely hides single-
letter frequencies
• The use of a larger matrix hides more frequency
information
• A 3 x 3 Hill cipher hides not only single-letter but
also two-letter frequency information
In the examples given, we shall walk through all the steps to use this cipher to act on digraphs
and trigraphs. It can be extended further, but this then requires a much deeper knowledge of
the background mathematics. Some important concepts are used throughout: Matrix
Multiplication; Modular Inverses; Determinants of Matrices; Matrix Adjugates (for finding
inverses).
Decryption
(Homework???)
Polyalphabetic Ciphers
• Polyalphabetic substitution cipher
• Improves on the simple monoalphabetic
technique by using different monoalphabetic
substitutions as one proceeds through the
plaintext message
• Use a random key that is as long as the message so that the key
need not be repeated
• Each new message requires a new key of the same length as the
new message
• Scheme is unbreakable
• Produces random output that bears no statistical relationship to the
plaintext
• Because the ciphertext contains no information whatsoever about
the plaintext, there is simply no way to break the code
Difficulties
• The one-time pad offers complete security but, in practice,
has two fundamental difficulties:
• There is the practical problem of making large quantities of
random keys
• Any heavily used system might require millions of random
characters on a regular basis
• Mammoth key distribution problem
• For every message to be sent, a key of equal length is needed
by both sender and receiver
• Steganography