Caesar Cypher
Cryptography and Network Security:Principles and Practice
Eighth Edition
Chapter 3
Classical Encryption Techniques
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Definitions(1 of 2)
- Plaintext
- –An original message
- Ciphertext
- –The coded message
- Enciphering/encryption
- –The process of converting from plaintext tociphertext
- Deciphering/decryption
- –Restoring the plaintext from the ciphertext
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Definitions(2 of 2)
- Cryptography
- –The area of study of the many schemes used forencryption
- Cryptographic system/cipher
- –A scheme
- Cryptanalysis
- –Techniques used for deciphering a message withoutany knowledge of the enciphering details
- Cryptology
- –The areas of cryptography and cryptanalysis
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Figure 3.1 Simplified Model ofSymmetric Encryption
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Symmetric Cipher Model
- There are two requirements for secure use of conventionalencryption:
- –A strong encryption algorithm
- –Sender and receiver must have obtained copies of thesecret key in a secure fashion and must keep the keysecure
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Figure 3.2 Model of SymmetricCryptosystem
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Cryptographic Systems
- Characterized along three independent dimensions:
- The type of operations used for transforming plaintext tociphertext
- –Substitution
- –Transposition
- The number of keys used
- –Symmetric, single-key, secret-key, conventionalencryption
- –Asymmetric, two-key, or public-key encryption
- The way in which the plaintext is processed
- –Block cipher
- –Stream cipher
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Cryptanalysis and Brute-Force Attack
- Cryptanalysis
- –Attack relies on the nature of the algorithm plus someknowledge of the general characteristics of theplaintext
- –Attack exploits the characteristics of the algorithm toattempt to deduce a specific plaintext or to deduce thekey being used
- Brute-force attack
- –Attacker tries every possible key on a piece ofciphertextuntil an intelligible translation into plaintext isobtained
- –On average, half of all possible keys must be tried toachieve success
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Table 3.1 Types of Attacks onEncrypted Messages
|
Type of Attack |
Known to Cryptanalyst |
|---|---|
|
Ciphertext Only |
|
|
Known Plaintext |
|
|
Chosen Plaintext |
|
|
Chosen Ciphertext |
|
|
Chosen Text |
|
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Encryption Scheme Security
- Unconditionally secure
- –No matter how much time an opponent has, it isimpossible for him or her to decrypt theciphertextsimply because the required information is not there
- Computationally secure
- –The cost of breaking the cipher exceeds the value ofthe encrypted information
- –The time required to break the cipher exceeds theuseful lifetime of the information
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Brute-Force Attack
- Involves trying every possible key until an intelligibletranslation of theciphertextinto plaintext is obtained
- On average, half of all possible keys must be tried toachieve success
- To supplement the brute-force approach, some degree ofknowledge about the expected plaintext is needed, andsome means of automatically distinguishing plaintext fromgarble is also needed
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Strong Encryption
- The termstrongencryptionrefers to encryption schemesthat make it impractically difficult for unauthorized personsor systems to gain access to plaintext that has beenencrypted
- Properties that make an encryption algorithm strong are:
- –Appropriate choice of cryptographic algorithm
- –Use of sufficiently long key lengths
- –Appropriate choice of protocols
- –A well-engineered implementation
- –Absence of deliberately introduced hidden flaws
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Substitution Technique
- Is one in which the letters of plaintext are replaced by otherletters or by numbers or symbols
- If the plaintext is viewed as a sequence of bits, thensubstitution involves replacing plaintext bit patterns withciphertextbit patterns
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Caesar Cipher
- Simplest and earliest known use of a substitution cipher
- Used by Julius Caesar
- Involves replacing each letter of the alphabet with theletter standing three places further down the alphabet
- Alphabet is wrapped around so that the letter following Zis A
plain: meet me after the toga party
cipher: PHHW PH DIWHU WKH WRJD SDUWB
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Caesar Cipher Algorithm
- Can define transformation as:
a b c d e f g hij 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
- b c d e f g hij 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
- Algorithm can be expressed as:
c = E(3, p) = (p + 3) mod (26)
- A shift may be of any amount, so that the general Caesar algorithm is:
C = E(k , p ) = (p + k ) mod26
- Where k takes on a value in the range 1 to 25; the decryption algorithm issimply:
p = D(k , C ) = (C − k ) mod26
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Figure 3.3 Brute-Force Cryptanalysisof Caesar Cipher
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Sample of Compressed Text
Figure 3.4Sample of Compressed Text
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
MonoalphabeticCipher
- Permutation
- –Of a finite set of elementsSis an ordered sequence ofall the elements ofS, with each element appearingexactly once
- If the “cipher” line can be any permutation of the 26alphabetic characters, then there are 26! orgreater than4 x 1026possible keys
- –This is 10 orders of magnitude greater than the keyspace for DES
- –Approach is referred to as amonoalphabeticsubstitutioncipher because a single cipher alphabet isused per message
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Figure 3.5 Relative Frequency ofLetters in English Text
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
MonoalphabeticCiphers
- Easy to break because theyreflect the frequency data of theoriginal alphabet
- Countermeasure is to providemultiple substitutes(homophones) for a single letter
- Digram
- –Two-letter combination
- –Most common isth
- Trigram
- –Three-letter combination
- –Most frequent isthe
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
PlayfairCipher
- Best-known multiple-letter encryption cipher
- Treatsdigramsin the plaintext as single units andtranslates these units intociphertextdigrams
- Based on the use of a 5×5 matrix of letters constructedusing a keyword
- Invented by British scientist Sir Charles Wheatstone in1854
- Used as the standard field system by the British Army inWorld War I and the U.S. Army and other Allied forcesduring World War II
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
PlayfairKey Matrix
- Fill in letters of keyword (minus duplicates) from left to rightand from top to bottom, then fill in the remainder of thematrix with the remaining letters in alphabetic order
- 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 |
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Figure 3.6 Relative Frequency ofOccurrence of Letters
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
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 frequencyinformation
- –A 3 x 3 Hill cipher hides not only single-letter but alsotwo-letter frequency information
- Strong against aciphertext-only attack but easily brokenwith a known plaintext attack
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Polyalphabetic Ciphers
- Polyalphabetic substitution cipher
- –Improves on the simplemonoalphabetictechnique byusing differentmonoalphabeticsubstitutions as oneproceeds through the plaintext message
- All these techniques have the following features incommon:
- –A set of relatedmonoalphabeticsubstitution rules isused
- –A key determines which particular rule is chosen for agiven transformation
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
VigenèreCipher
- Best known and one of the simplest polyalphabeticsubstitution ciphers
- In this scheme the set of relatedmonoalphabeticsubstitution rules consists of the 26 Caesar ciphers withshifts of 0 through 25
- Each cipher is denoted by a key letter which is theciphertextletter that substitutes for the plaintext letter a
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Example ofVigenèreCipher
- To encrypt a message, a key is needed that is as long asthe message
- Usually, the key is a repeating keyword
- For example, if the keyword isdeceptive, the message “weare discovered save yourself” is encrypted as:
key:deceptivedeceptivedeceptive
plaintext:wearediscoveredsaveyourself
ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
VigenèreAutokeySystem
- A keyword is concatenated with the plaintext itself toprovide a running key
- Example:
key:deceptivewearediscoveredsav
plaintext:wearediscoveredsaveyourself
ciphertext: ZICVTWQNGKZEIIGASXSTSLVVWLA
- Even this scheme is vulnerable to cryptanalysis
- –Because the key and the plaintext share the samefrequency distribution of letters, a statistical techniquecan be applied
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
VernamCipher
Figure 3.7VernamCipher
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
One-Time Pad
- Improvement toVernamcipherproposed by an Army SignalCorp officer, JosephMauborgne
- Use a random key that is aslong as the message so thatthe key need not be repeated
- Key is used to encrypt anddecrypt a single message andthen is discarded
- Each new message requires anew key of the same length asthe new message
- Scheme is unbreakable
- –Produces random outputthat bears no statisticalrelationship to theplaintext
- –Because theciphertextcontains no informationwhatsoever about theplaintext, there is simplyno way to break the code
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Difficulties
- The one-time pad offers complete security but, in practice, has twofundamental difficulties:
- –There is the practical problem of making large quantities ofrandom keys
- Any heavily used system might require millions of randomcharacters on a regular basis
- –Mammoth key distribution problem
- For every message to be sent, a key of equal length is neededby both sender and receiver
- Because of these difficulties, the one-time pad is of limited utility
- –Useful primarily for low-bandwidth channels requiring very highsecurity
- The one-time pad is the only cryptosystem that exhibitsperfectsecrecy(see Appendix F)
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Rail Fence Cipher
- Simplest transposition cipher
- Plaintext is written down as a sequence of diagonals andthen read off as a sequence of rows
- To encipher the message “meet me after the toga party”with a rail fence of depth 2, we would write:
m e m a t r h t g p r y
e t e f e t e o aat
Encrypted message is:
MEMATRHTGPRYETEFETEOAAT
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Row Transposition Cipher
- Is a more complex transposition
- Write the message in a rectangle, row by row, and read themessage off, column by column, but permute the order ofthe columns
- –The order of the columns then becomes the key to thealgorithm
Key:4 3 1 2 5 6 7
Plaintext: a tta c k p
o s t p o n e
d u n til t
w o a mx y z
Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Summary
- Present an overview of the main concepts of symmetriccryptography
- Explain the difference between cryptanalysis and brute-force attack
- Understand the operation of amonoalphabeticsubstitutioncipher
- Understand the operation of a polyalphabetic cipher
- Present an overview of the Hill cipher
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.