You are on page 1of 12

Caesar Cipher

• earliest known substitution cipher


• by Julius Caesar
• first attested use in military affairs
• Each character of a plain text is replaced by replaces each letter by a
character n position down in the alphabet
Caesar Cipher
• Both parties (sender and receiver) have the 'key' for the cipher,
• For the caesar cipher, the key is the number of characters to shift the cipher alphabet.

Example 1:
Encryption with key=1
plaintext: defend the east wall of the castle
ciphertext: efgfoe uif fbtu xbmm pg uif dbtumf

Example 2:
Decryption with key=1
plain: abcdefghijklmnopqrstuvwxyz
cipher: bcdefghijklmnopqrstuvwxyza
Caesar Cipher
• Both parties (sender and receiver) have the 'key' for the cipher,
• For the caesar cipher, the key is the number of characters to shift the cipher alphabet.

Example 1:
Encryption with key=1
plaintext: defend the east wall of the castle
ciphertext: efgfoe uif fbtu xbmm pg uif dbtumf

Example 2:
Decryption with key=1
ciphertext: efgfoe uif fbtu xbmm pg uif dbtumf
plaintext: defend the east wall of the castle
Caesar Cipher
Mathematical Description
• First we translate all of our characters to numbers, 'a'=0, 'b'=1, 'c'=2, ... , 'z'=25.
• We can now represent the caesar cipher encryption function, e(x), where x is the character we
are encrypting, as:

• Where k is the key (the shift) applied to each letter.


• After applying this function the result is a number which must then be translated back into a
letter.
• The decryption function is :
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
Cryptanalysis of Caesar Cipher- Example
Our ciphertext is the following:

YMJHFJXFWHNUMJWNXTSJTKYMJJFWQNJXYPSTBSFSIXNRUQJXYHNUMJWX
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 characteristics and Cryptanalysis
• 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
• calculate letter frequencies for ciphertext
• compare counts/plots against known values
Example Cryptanalysis
• given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVP

• count relative letter frequencies (see text)


• guess P & Z are e and t
• guess ZW is th and hence ZWSZ is that
• proceeding with trial and error finally get:
it was disclosed yesterday that several informal but
direct contacts have been made

You might also like