Cryptography - Day 5: The Vigenère and Fish Ciphers

Cryptography - Day 5: The Vigenère and Fish
Ciphers
MA 111: Intro to Contemporary Math
October 7, 2013
Vigenère Cipher
The Vigenère Cipher uses a different shift for each letter,
depending on the position of the letter in the message.
Encryption uses the rule k + ∆k (mod n) = k .
A keyword is used to efficiently describe the encryption
sequence; for example, the keyword CAT means ∆1 = 3,
∆2 = 1, and ∆3 = 20.
Decryption uses the rule k + ∇k (mod n) = k , where ∇k is
the additive inverse of ∆k (mod n).
Congratulations, You Are Now A (Better) Spy 4
Agent GALLANT starts using a new keyword, but you figure out
that the shifts being used are
∆1 = 26, ∆2 = 5, ∆3 = 2 ∆4 = 18, ∆5 = 1.
I
What Keyword is being used for this Vigenère Cipher?
I
What is the decryption sequence?
I
Decrypt the ciphertext message “TFTYFT”.
I
If Agent GALLANT uses the keyword TOME instead, what is
the decryption sequence?
Advantages of the Vigenère Cipher
The Vigenère Cipher is a HUGE improvement over Shift
Ciphers because any single letter can be encrypted in many
different ways.
Theorem (Counting Possibilities for the Vigenère Cipher)
The number of different ways a letter can be encrypted using
the Vigenère Cipher is exactly the length of the keyword being
used (assuming the keyword has no repeated letters).
Example
For a Vigenère Cipher that uses the keyword “TWIN”, the
letter “E” could be encrypted using “T”, “W”, “I”, or “N”. This
means that “E” could be encrypted as
Plaintext Numeric Keyword Numeric
Ciphertext 5
20
Y
5
23
B
5
9
N
5
14
S
Code Summary: Vigenère Cipher
The summary below represents information about codes when
encrypting and decrypting English language plaintext.
Cipher
Encrypt
Decrypt
Caesar
Shift
Vigenère
3
∆
∆1 ∆2 . . .
23
∇
∇1 ∇2 . . .
Key
Secrecy
Private
Private
Private
Letter
Frequency
Normal
Normal
Better
Related Idea: Vigenère Cipher Square
Congratulations, You Are Now A (Better) Spy 6
Agent GALLANT tries to stay one step ahead of you. Instead of
encrypting using a Vigenère Cipher with a single keyword, he
decides to encrypt twice using two keywords! Fortunately, a
double agent passes along the two keywords that he uses:
Keyword 1: PLAN
Keyword 2: NOW
I
How would Agent GALLANT encrypt the plaintext “NOON”
if he uses a Vigenère Cipher first with the Keyword 1 and
then again with Keyword 2?
I
Which decryption sequence (for Keyword 1 or 2) would you
have to use FIRST to decrypt the ciphertext?
Encryption Method: Fish Cipher
Definition
A Fish Cipher encrypts like a Vigenère Cipher, but uses two (or
more) keywords. The process of encryption involves stages:
(i) First, encrypt the plaintext using the first keyword;
(ii) Next, encrypt the result of Step (i) with the second
keyword.
Example
Encrypt the word “Hello” with the keywords BYE and NOW.
∆k
∆k
8
2
14
24
X
5
25
15
19
S
12
5
23
40
N
12
2
14
34
T
15
25
15
32
Q
Encrypting/Decrypting Example
Using the keywords PLAN and NOW:
I
Encrypt “HOUSE”
I
Decrypt “KIMUY”
Using the keywords MONEY and CASH:
I
Encrypt “MOOLAH”
I
Decrypt “IMHT”
Related Idea: Least Common Multiple
Definition
The Least Common Multiple of two numbers a and n, often
written as
lcm(a, n)
is the smallest number that is a multiple of both a and n.
Example (Least Common Multiple)
I
lcm(2, 3) = 6 = lcm(2, 6)
I
lcm(3, 4) = 12
I
lcm(5, 10) = 10
I
lcm(9, 12) = 36
Drill Time: Least Common Multiple
Find the least common multiple of each of the following. Check
your answers with a neighbor!
I
lcm(3, 8)
I
lcm(2, 8)
I
lcm(12, 18)
I
lcm(15, 10)
I
lcm(17, 51)
I
lcm(10, 21)
Least Common Multiples
Least common multiples are important to codes in the following
way. We will usually assume that individual keywords have
no repeated letters, but it is okay for letters to repeat from
keyword to keyword.
Theorem (Counting Possibilities for the Fish Cipher)
The number of different ways a letter can be encrypted using
the Fish Cipher (or using the Vigenère Cipher twice) is at most
the least common multiple of the lengths of the keywords being
used (or 26, whichever is less).
Example (Counting Fish Cipher Possibilities)
How many different ways can a single letter be encrypted using
the Fish Cipher if both of the following keywords are used?
I
“RED” and “GRAPE”
lcm(3, 5) = 15
I
“RED” and “DEVILS”
lcm(3, 6) = 6
Congratulations, You Are Now A (Better) Spy 7
Agent GALLANT keeps using a Fish Cipher.
I
If he uses the same keywords from before
Keyword 1: PLAN
Keyword 2: NOW
how many ways can a single letter be encrypted?
I
If he uses the keywords
Keyword 1: MAN
Keyword 2: FRIDAY
how many ways can a single letter be encrypted?
The Return of GOOFUS
Agent GOOFUS follows Agent GALLANT and starts using an
English Fish Cipher. He considers using the following
keywords:
TO, FIVES, FROM, ADORE, YOU, MAN
I
If Agent GOOFUS uses the keywords TO and FROM how
many ways can a single letter be encrypted?
I
Which two keywords encrypt a single letter in the most
different ways?
Code Summary: Fish Cipher
The summary below represents information about codes when
encrypting and decrypting English language plaintext.
Cipher
Encrypt
Decrypt
Caesar
Shift
Vigenère
3
∆
∆1 ∆2 . . .
∆1 ∆2 . . .
∆1 ∆2 . . .
23
∇
∇1 ∇2 . . .
∇1 ∇2 . . .
∇1 ∇2 . . .
Fish
Key
Secrecy
Private
Private
Private
Private
Letter
Frequency
Normal
Normal
Less Predictable
Even Less
Predictable
Quiz 2 - Wed. 10/9/2013
I
Simplify positive & negative mods
I
Find additive inverses
I
Encrypt/Decrypt using a Shift Cipher
I
Describe Encryption/Decryption rules
I
∆ and ∇ notation
I
Encrypt/Decrypt using a Vigenère Cipher
I
Keywords, Encryption/Decryption Sequences
I
Encrypt using a Fish Cipher
I
Familiarity with lcm and Fish Cipher possibilities
Simplifying Negative Mods
I
Simplify −7(mod 15).
I
Simplify −17(mod 26).
I
Simplify −23(mod 8).
I
Simplify −37(mod 23).
I
Simplify −43(mod 14).
I
Simplify −87(mod 19).
I
Simplify −44(mod 3).
I
Simplify −66(mod 13).
I
Simplify −105(mod 27).
I
Simplify −1857(mod 37).
Homework Assignments
1. Study for Quiz 2 - Wed 10/9
2. Homework 7 - Cryptography 3 - due Fri 10/11 - 11:59 PM