A one-time pad is the only theoretically unbreakable cipher. A one-time pad is a private key, or symmetric, cipher where the key size is equal to the plaintext size. Because of this, the key is never reutilized. As the key is never reutilized, there is no basis for mathematical cryptanalysis.

An example of a very poor one-time pad would be if you were to encrypt a letter to a friend using a substitution cipher and using Hemingway’s A Farewell to Arms as a key. Your friend could decrypt your letter using an identical copy of A Farewell to Arms. No one else would be able to decrypt your message, unless they had a copy of the book you were using as a key.

This is actually a very poor one-time pad because books do not have random text. A message encrypted using a book as a one-time pad would actually not be difficult to cryptanalyze.

For a one-time pad to be truly unbreakable, the key must be generated with effective randomness.

One-time pad ciphers are sometimes called Vernam ciphers.