Preview lessons, content and tests

Computer Science & Programming solved. All in one platform.

1. To trial the platform and take tests, please take a few seconds to SIGN UP and SET UP FREE.
2. Searching for something specific? See our text overview of all tests. Scroll right for levels, and lists.

Join 36000+ teachers and students using TTIO.

Vernam Cipher

The Vernam cipher is, in theory, a perfect cipher. Instead of a single key, each plaintext character is encrypted using its own key. This key — or key stream — is randomly generated or is taken from a one-time pad, e.g. a page of a book. Read more here: https://www.cryptomuseum.com/crypto/vernam.htm

Suggested Video

As introduction to stream ciphers, and to demonstrate that a perfect cipher does exist, we describe the Vernam Cipher, also known as the one-time-pad.

Gilbert Vernam invented and patented his cipher in 1917 while working at AT&T. The teletype had been recently introduced, and along with this the commerical Baudot code. Now messages were uniformly thought of as streams of zero's and one's (But the word "bit" was not yet invented. This is due to Shannon in the 40's.)

Vernam proposed a bit-wise exclusive or of the message stream with a truely random zero-one stream which was shared by sender and receipient.

Example:

   SENDING
   -------
   message: 0 0 1 0 1 1 0 1 0 1 1 1 ...
   pad:     1 0 0 1 1 1 0 0 1 0 1 1 ...
   XOR      ---------------------------
   cipher:  1 0 1 1 0 0 0 1 1 1 0 0 ...

   RECEIVING
   ---------
   cipher:  1 0 1 1 0 0 0 1 1 1 0 0 ...
   pad:     1 0 0 1 1 1 0 0 1 0 1 1 ...
   XOR      ---------------------------
   message: 0 0 1 0 1 1 0 1 0 1 1 1 ...

This cipher is unbreakable in a very strong sense. The intuition is that any message can be transformed into any cipher (of the same length) by a pad, and all transformations are equally likely. Given a two letter message, there is a pad which adds to the message to give OK, and another pad which adds to the message to give NO. Since either of these pads are equally likely, the message is equally likely to be OK or NO.

www.teachyourselfpython.com