In cryptography, a cipher replaces a piece of information (a syntactic element of the plaintext that may consist of a letter or grouping of letters without inherent meaning) with another letter or letter group.
The transposition or substitution is controlled by a cryptographic algorithm (or procedure). In most cases, that procedure is varied depending on a key which changes the detailed operation of the algorithm. If the algorithm is symmetric, the key must be known to the receipient and to no one else. If the algorithm is an asymmetric one, the encyphering key is different from, but closely related to, the decyphering key. If one key cannot be deduced from the other, the asymmetric key algorithm has the public/private key property and one of the keys may be made public without loss of confidentiality.
In the past, the blurring of the distinction between codes and ciphers was relatively unimportant for anyone except cryptographers. In contemporary communications, however, information is frequently both encoded and encrypted, so that it is important to understand the difference. A satellite communications link, for example, may 'encode' information in ASCII characters if it is textual, or into some other representation of the data such as a JPEG file if it is an image. In neither case is confidentiality a desiratum. Optionally, the transmission may then be encyphered using (for instance) the Data Encryption Standard (DES). Finally, the cipher stream itself is 'encoded' again, using error-correcting codes for transmission from the ground station to the orbiting satellite. These operations are undone, in reverse order, after reception to recover the original information.
Note the multiple meanings of the word code in this example. Thinking clearly with words having such flexibility is not easy.
Most modern ciphers can be categorized in several ways:
See also: Code, Cryptography, Cryptology