thumb|U.S. State Department code book issued in 1899, an example of a one-part code, at the [[National Cryptologic Museum]]

thumb|Page 187 of the State Department 1899 code book, a one-part code with a choice of code word or numeric ciphertext. Numeric codes are prefixed by the page number.

A codebook is a type of document used for gathering and storing cryptography codes. Originally, codebooks were often literally <span lang="en-us" dir="ltr">books</span>, but today "codebook" is a byword for the complete record of a series of codes, regardless of physical format.

Cryptography

In cryptography, a codebook is a document used for implementing a code. A codebook contains a lookup table for coding and decoding; each word or phrase has one or more strings which replace it. To decipher messages written in code, corresponding copies of the codebook must be available at either end. The distribution and physical security of codebooks presents a special difficulty in the use of codes compared to the secret information used in ciphers, the key, which is typically much shorter.

The United States National Security Agency documents sometimes use codebook to refer to block ciphers; compare their use of combiner-type algorithm to refer to stream ciphers.

Codebooks come in two forms, one-part or two-part:

  • In one-part codes, the plaintext words and phrases and the corresponding code words are in the same alphabetical order. They are organized similar to a standard dictionary. Such codes are half the size of two-part codes but are more vulnerable since an attacker who recovers some code word meanings can often infer the meaning of nearby code words. One-part codes may be used simply to shorten messages for transmission or have their security enhanced with superencryption methods, such as adding a secret number to numeric code words.

Two-part codebooks go back as least as far as

Antoine Rossignol in the 1800s.

Codebooks with superencryption were the most used cryptographic method of World War I.