Categories
cryptography mathematics

Definition of Cipher

authored by Premmi and Beguène

A cipher defines the mechanism through which a message is transformed into a ciphertext using a key such that only the entities sharing this key could use it to decrypt the ciphertext and recover the message.

A cipher, \mathcal{E}, comprises of a pair of functions, namely, the encryption and decryption functions. That is,

\mathcal{E} = (E, D)

where E denotes the encryption function and D, the decryption function.

The encryption function, E, takes as input a key, k, and a message, m and produces as output a ciphertext, c. That is,

c = E(k, m)

and we refer to ciphertext, c, as the encryption of m under k.

The decryption function, D, takes as input a key, k, and a ciphertext, c and produces as output a message, m. That is,

m = D(k,c)

and we refer to message, m, as the decryption of c under k.

Since it must be possible to recover m given c \text{ and } k, the cipher must satisfy the following correctness property.

For every key in the key space and every message in the message space,

D(k, \,E(k, m)\,) = m

An alternate way to write the encryption and decryption functions are as follows:

\begin{equation*} 
\begin{split}
E &: \mathcal{K} \,{\small \times}\, \mathcal{M} \rightarrow \mathcal{C} \, \&\\ 
D &: \mathcal{K} \,{\small \times}\, \mathcal{C} \rightarrow \mathcal{M} \\
\end{split}
\end{equation*}

where \mathcal{K} denotes the set of all keys i.e., the key space, \mathcal{M} the set of all messages i.e., the message space and \mathcal{C} the set of all ciphertexts i.e., the ciphertext space.

Henceforth, we will refer to the cipher, \mathcal{E}, as being defined over (\mathcal{K,\, M,\, C}).

Computers process information which they receive in the form of input sequences. An input sequence is a finite sequence of symbols from some alphabet \mathit{A}. Since the most basic way of transmitting information is to code it into strings of 0\text{s and } 1\text{s}, such as 0010101, 1011001, etc., the alphabet \mathit{A} consists of only the two symbols, namely, 0 \text{ and } 1, i.e., \mathit{A} = \{0, 1\}.

Such strings of 0\text{s and } 1\text{s} are called binary words, and the number of 0\text{s} and 1\text{s} in any binary word is called its length. That is, a binary word of length n is a string of n binary digits (a digit is either a 0 \text{ or } 1) or bits. Output sequences are defined in the same way as input sequences. The set of all sequences of symbols in this alphabet A of length L is denoted by \mathit{A} = \{0, 1\}^L.

Hence, the keys, the messages and the ciphertexts are coded in the computers as sequences of bits.

The key space \mathcal{K}, which is the set of all possible keys, each of length L, is represented as \mathcal{K} := \{0, 1\}^L. Similarly, \mathcal{M} := \{0, 1\}^L and \mathcal{C} := \{0, 1\}^L, represent the message space and the ciphertext space, where each message or ciphertext is a binary word of length L.

We will also assume that \mathcal{K,\, M} \text{ and } \mathcal{C} are finite sets.