Reading: Chapter 16
wherein the Alice-Bob subplot develops
| STARRING | |||
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
| Alice | Bob | Eve | Spot |
Prologue: Alice and Bob want to talk. Clever, evil Eve wants to eavesdrop. Alice and Bob wonder what to do.
x mod N is the remainder when x is divided by N.
For addition, this gives wrap-around behavior.
{ x + y if x + y < N
(x + y) mod N = {
{ x + y - N otherwise
Subtraction inverts this.
{ x - y if x - y >= N
(x - y) mod N = {
{ x - y + N otherwise
Note:
[(x + y) mod N - y] mod N = x
Alice and Bob agree on a key in private. Now they can talk alound, encoding messages with the key.
Drats!
Fine, but what's a key and how can we use it?
Alice and Bob agree on a number between 0 and 26. (Say 4.)
Alice adds number to each letter mod 27.
I _ D O -> M D H SBob subtracts number (mod 27) from each letter received.
M D H S <- I _ D O
Arr!
Try a shuffling of letters. Alice and Bob agree on the mapping as their key.
original _ A B C D E F G H I J K L M N O ... destination @ A X J E W U I D C H T N M B R ...
Alice maps her message using the mapping.
I _ D O -> C @ E RShe sends, ``C@ER.'' To decrypt, Bob reverses the mapping
C @ E R <- I _ D O
Any long English messages can be decoded by analyzing letter frequency.
The letter occurring most is
probably an `E'.
Newspaper cryptograms show how easy breaking Kaptain Krunch's code is.
Shiver me timbers!
If, for every possible encrypted message X,
Pr[X is encryption]is same regardless of original message M, we have achieved perfect security.
(The probability here is over choice of random key K.)
Say Alice and Bob agree to a series of random numbers between 0 and 26.
2, 23, 20, 8, 16, ...
To encrypt, Alice adds numbers to corresponding letters.
I _ D O + 2 +23 +20 + 8 --- --- --- --- K W X WBob subtracts to get original.
K W X W - 2 -23 -20 - 8 --- --- --- --- I _ D O
This is called the one-time pad.
What is probability that encryption is KWXW if original is I_DO, for random key?
What if original is NOPE?
Drat!
Often Alice and Bob can't communicate key in private. This is a job for public-key cryptography.
Now Bob has two keys, one published, one kept to himself.
A message encrypted with the public key can only be decrypted with a private key.
The most popular public-key cryptosystem is RSA. (PGP is one implementation.)
In RSA, the public key is a product of two large prime numbers. The private key has the two primes.
RSA is not as secure as one-time pad. It is broken if the public key is factored.
But after 2,500 years of looking, we still don't know a fast factoring algorithm.
Alice, Bob, Krunch, and Spot just got their test grades.
![]() |
![]() |
![]() |
![]() |
| 95 | 88 | 82 | 50 |
|---|
They want to know their average score, but nobody wants to reveal their grades. What can they do?
All behave the same.
(rBA + rBS + rBK + rBB) mod 401 = Bob's score (88)
cB = (rAB + rSB + rKB + rBB) mod 401Give cB to everybody, get cA, cS, and cK.
sends to whom
who Alice Bob Spot Krunch score
Alice 135 240 301 221 95
Bob 285 363 109 133 88
Spot 135 300 334 83 50
Krunch 132 5 230 116 82
total 286 106 172 152 315
In class, Ankur suggested that in a public-key cryptosystem Eve might be able to guess the message Alice sends, encrypt it with Bob's key, and thus verify what it was Alice sent. I didn't have an answer to it then.
There is an answer, though: Alice can include in the message two parts.