PGSS Computer Science Core Slides

Prologue: Alice and Bob want to communicate a secret. Clever, evil Eve wants to eavesdrop. Alice and Bob wonder what to do.

Private-Key Cryptography

Alice and Bob agree on a key in private.

Now they can talk aloud, encoding messages with the key.

Fine, but what's a key and how can we use it?

Kaptain Krunch Secret Decoder Ring

Try a shuffling of letters. Alice and Bob agree on the mapping

  _ A B C D E F G H I J K L M N O ...
  @ A X J E W U I D C H T N M B R ...
Alice encrypts her message using the mapping.
  I _ D O
  C @ E R
She broadcasts C@ER. Now Bob reverses the mapping to decrypt.
  C @ E R
  I _ D O

But Eve's Clever!

Any long English message can be decoded by analyzing letter frequency. Eve would think, ``The letter occurring most is probably an `E'.'' Newspaper cryptograms show how easy breaking Kaptain Krunch's code is.

What Do We Want?

We want the encrypted message to provide no help in figuring out the original message.

Another way of looking at it is with a probability distribution. The encrypted message should not alter our suspicions about the original. We want

  Pr[x is original, given encryption] = Pr[x is original]
for all x.

How Can We Do It?

Say Alice and Bob agree to a series of random numbers between 0 and 26. They agree on 0, 5, 26, 13.

To encrypt, Alice adds each number to the corresponding letter.

    I      _      D      O
 +  0   +  5   + 26   + 13
    I      E      C      A
So now she sends IECA to everybody.

To decrypt, Bob subtracts each number from the corresponding letter of Alice's message.

    I      E      C      A
 -  0   -  5   - 26   - 13
    I      _      D      O

Bayes' Theorem


  Pr[x and y] = Pr[y] Pr[x given y]
  Pr[y and x] = Pr[x] Pr[y given x]
  Pr[x and y] = Pr[y and x]
this implies Bayes' Theorem:
                  Pr[x] Pr[y given x]
  Pr[x given y] = -------------------

Does It Work?

  Pr[x is original, given encryption y]

     Pr[x is original] Pr[encryption y, given x]
   = -------------------------------------------
                Pr[y is encryption]


Pr[encryption y, given x] = 1 / 27
Pr[y is encryption] 

  =    sum      Pr[key is k] Pr[y is x + k]
   0 <= k <= 26

  =    sum      (1 / 27) Pr[y is x + k]
   0 <= k <= 26

  = (1 / 27)    sum      Pr[y is x + k]
            0 <= k <= 26

  = 1 / 27
  Pr[x is original, given encryption y] = Pr[x is original]
Thus this cryptographic scheme is perfect.

Public Key Cryptography

Often Alice and Bob can't communicate key in private. This is a job for... public-key cryptography!

Public Keys

Now Bob has two keys, one published, one kept to himself.

A message encrypted with the published key can only be decrypted with the key Bob has kept.

This way Alice can encrypt her message with Bob's published key. Since only Bob has the key to decrypt this message, she has successfully done it.

That is, assuming this is really possible. But there are some reasonable schemes out there that work. We're not talking about them now, however.