Wed 10/16 Slides

advertisement
Cryptography - Day 9: Affine Ciphers and
Diffie-Hillman-Merkle Public Key Exchange
MA 111: Intro to Contemporary Math
October 16, 2013
Decryption Method: Times Cipher
Definition (Decryption: Times Cipher)
A Times Cipher
∗ × (mod n) = can be decrypted by finding a value so that
∗ · = 1(mod n)
Decryption can be described completely as
× (mod n) = ,
where ∗ · = 1(mod n).
Related Idea: Multiplicative Inverse
Definition (Related Idea: Multiplicative Inverse)
The multiplicative inverse for a(mod n) is a value â so that
a · â = 1(mod n)
For English (or any Roman alphabet) Language, we will always
have
∗ · = 1(mod 26).
If a Language has n letters, then we have
∗ · = 1(mod n).
Using multiplicative inverses is as close to division as we can
get!
Related Idea: Finding Multiplicative Inverses
Theorem (Related Idea: Finding Multiplicative Inverses)
To find the multiplicative inverse to a(mod n), make two lists:
(i) Make multiples of the value n:
{n, 2n, 3n, 4n, . . .}
(ii) Add 1 to every member of the list from step (i):
{n + 1, 2n + 1, 3n + 1, 4n + 1, . . .}
Starting with n + 1, divide each number in the list from
Step (ii) by a. If a division produces a whole number (no
remainder/decimal), then the resulting number is the
multiplicative inverse for a.
If not, move onto the next number. Sometimes you have to
go back and extend your lists.
Times Cipher Practice
I
Encrypt the message “ENGLISH” with a Times Cipher
where ∗ = 3.
I
Since ∗ = 3, what is ?
I
Decrypt the message “MCHX” with a Times Cipher where
∗ = 3.
I
Consider a Times Cipher with ∗ = 5. What is ?
I
Decrypt the message “IAYQQ” with a Times Cipher where
∗ = 5.
Code Summary: Add in the Times Cipher
The summary below represents information about codes when
encrypting and decrypting English language plaintext.
Cipher
Caesar
Shift
Vigenère
Fish
Times
Encrypt
Key(s)
3
∆
∆1 ∆2 . . .
∆1 ∆2 . . .
∆1 ∆2 . . .
∗
Decrypt
Key(s)
23
∇
∇1 ∇2 . . .
∇1 ∇2 . . .
∇1 ∇2 . . .
Key
Secrecy
Private
Private
Private
Private
Private
Letter
Frequency
Normal
Normal
Less Predictable
Even Less
Predictable
Normal
Encryption Method: Affine Cipher
Definition
An English Affine Cipher encrypts as a combination of a Shift
Cipher using shift ∆ and a Times Cipher using scale ∗.
The conversion from plaintext in a language with n letters to
ciphertext is represented by the formula
(∗ × ) + ∆(mod n) = .
(Multiply by ∗ first, add ∆ second, and (mod n) last.)
Big Connection: Which Affine Ciphers Work?
Theorem (Valid Affine Ciphers)
The Affine Cipher (∗ × ) + ∆(mod n) = is only valid when
gcd(∗, n) = 1. (∆ can be anything!)
So, ∗(mod n) needs to be a unit, just like it needed to be for a
Times Cipher.
Example
The encryption scheme (6 × ) + ∆(mod 26) = is not a
valid English Affine Cipher. This is because gcd(6, 26) = 2 6= 1.
The encryption scheme (7 × ) + ∆(mod 24) = is a valid
Greek Affine Cipher. This is because gcd(7, 24) = 1.
GOOFUS and GALLANT 6
One last test before Agent GOOFUS is reinstated!
I
Is 5 × + 3(mod 26) = a valid Affine Cipher?
I
Is 11 × + 13(mod 26) = a valid Affine Cipher?
I
Is 11 × + 10(mod 22) = a valid Affine Cipher?
I
Is 10 × + 11(mod 22) = a valid Affine Cipher?
I
Is 4 × + 5(mod 15) = a valid Affine Cipher?
I
Is 5 × + 4(mod 15) = a valid Affine Cipher?
Decryption Method: Affine Cipher
Definition
Decrypting an Affine Cipher (∗ × ) + ∆(mod n) = requires
finding two values:
(i) The multiplicative inverse (mod n) to ∗(mod n);
(ii) The additive inverse ∇(mod n) to ∆(mod n)
Decryption can be described completely as
× ( + ∇)(mod n) = .
(Add ∇ first, multiply by second, and (mod n) last.)
Affine Cipher Practice
Consider the following Affine Cipher: 3 × + 5(mod 26) = .
I
Is this a valid Affine Cipher?
I
What are ∗ and ∆ in this case?
I
Encrypt the message “DRINK” using this Affine Cipher.
I
What are and ∇ for this Affine Cipher?
I
What is the decryption rule for this Affine Cipher?
I
Decrypt the message “JUHNL” using this Affine Cipher.
Code Summary: Add in the Affine Cipher
The summary below represents information about codes when
encrypting and decrypting English language plaintext.
Cipher
Caesar
Shift
Vigenère
Fish
Times
Affine
Encrypt
Key(s)
3
∆
∆1 ∆2 . . .
∆1 ∆2 . . .
∆1 ∆2 . . .
∗
∗, ∆
Decrypt
Key(s)
23
∇
∇1 ∇2 . . .
∇1 ∇2 . . .
∇1 ∇2 . . .
, ∇
Key
Secrecy
Private
Private
Private
Private
Private
Private
Letter
Frequency
Normal
Normal
Less Predictable
Even Less
Predictable
Normal
Normal
Related Ideas: Key Distribution & Public Key Cipher
The main problem of Key Distribution in cryptography is trying
to give all intended recipients the necessary key to decrypt
messages, while simultaneously keeping those keys secret in
general.
A major goal of cryptography is a Public Key Cipher. This is a
code system where the encryption key can be freely visible to
anyone, but only the intended recipient has the means of using
the decryption key.
Related Ideas: Key Distribution & Public Key Cipher
For example, suppose that you want to check your savings
account balance online, but you’d rather nobody else knows
what this is.
You use a login and password for the bank to verify your identity.
But, how does the bank actually SEND you your account
information? The number has to go through various routing
points, all of which can be hacked.
The bank could ENCRYPT the account information, but how
would you (or your computer) know how to decrypt it?
Encryption: DHM Key Exchange
Definition
The DHM Key Exchange allows two parties that have no prior
knowledge of each other to exchange a secret key over
(possibly insecure) communication lines.
I
DHM is named after the scientists Diffie, Hellman, and
Merkle, who first published an article about the key
exchange.
I
British Intelligence actually knew about DHM before Diffie,
Hellman, and Merkle, but kept the key exchange a secret
for national security reasons.
I
The idea of how this works is based on a mathematical
process that is EASY to do, but SUPER HARD to undo.
Related Idea: Large # Modular Arithmetic
Recall from algebra that an = a
| · a{z· · · a}.
n copies
Example
Let’s compute 829 (mod 41). (Even expensive graphing
calculators will return an answer that is rounded off.)
1. We need to find an exponent 8k (mod 41) that our
calculator CAN handle. A smaller calculation we can make
is 87 (mod 41) = 2.
2. Now break up the big exponent into smaller ones using the
previous step. To calculate 829 (mod 41), we will think of 29
as
29 = 7 + 7 + 7 + 7 + 1.
3. The big exponent can be calculated using the pieces from
the previous step. Here it turns out that
829 (mod 41) = 87 · 87 · 87 · 87 · 81 (mod 41)
Homework Assignments
1. read pp. 395-396 on Public Key Cryptography
2. Homework 8 - Cryptography 4 - due Thurs 10/17 - 6:00 AM
Download