User:Matt Crypto/Simplified Cryptography

Cryptography (from Greek krypt&oacute;s, "hidden", and gr&aacute;phein, "to write") is, traditionally, the practice of rendering information in an obscured form in order to prevent others from understanding it. In recent decades, cryptography has expanded its remit and now provides mechanisms for a wide range of security goals, in addition to the ever-important task of ensuring secrecy in communications. Cryptography is an interdisciplinary subject, drawing from several fields: it can be viewed as an application of information theory, and yet it makes extensive use of other areas of mathematics too, notably number theory. It is also a branch of engineering, but an unusual one as it must deal with active, intelligent and malevolent opposition (see cryptographic engineering and security engineering).

Closely related fields are steganography, which is distinguished from cryptography as the study of ways of obscuring the very existence of a message, and not the contents of the message itself; and traffic analysis, which is the analysis of patterns of communication in order to gain knowledge.

Terminology
The original information which is to be protected by cryptography is called the plaintext. Encryption is the process of converting plaintext into an unreadable form, termed ciphertext, or, occasionally, a cryptogram. Decryption is the reverse process, recovering the plaintext back from the ciphertext. Enciphering and deciphering are alternative terms. A cipher is an algorithm for encryption and decryption. The exact operation of a cipher is almost always controlled by one or more keys &mdash pieces of information that customise the encryption and decryption. Protocols specify the details of how ciphers (and other cryptographic primitives) are to be used to achieve specific tasks. Protocols, cryptographic algorithms, prescribed actions and other specifics are combined together and implemented in a cryptosystem.

In ordinary parlance, a (secret) "code" is synonymous with "cipher". In cryptography, however, the term has a specialised, technical meaning, and should be avoided unless this is intended.

The study of how to circumvent the use of cryptography is called cryptanalysis; an attack is a specific attempt at or method for cryptanalysis. Cryptography and cryptanalysis are sometimes linked together under the umbrella term "cryptology", though "cryptography" also has this wider meaning, and both are acceptable terms for the entire field. "Crypto" is a common informal abbreviation for cryptography

"Cipher" is alternatively spelt "cypher"; similarly "ciphertext" and "cyphertext", and so forth. Although both spellings have long histories in English, there is occasional tension between their adherents.

Cryptanalysis
Main article: Cryptanalysis

A cryptanalyst might appear to be the natural adversary of a cryptographer, and to an extent this is true: one can view this contest all through the history of cryptography. However, it is also possible to interpret the two roles as complementary: a thorough understanding of cryptanalysis is necessary to create secure cryptography.

A variety of different assumptions are considered regarding what an attacker can know and do in order to learn secret information. One important distinction is whether the cryptanalyst has access only to ciphertext, whether he also knows or can guess some corresponding plaintexts, or even if he can choose plaintexts to be encrypted; (see ciphertext only, known plaintext and chosen plaintext). These scenarios all view the cipher as a black box. Some attacks, however, are based on the implementation of the cipher. If a cryptanalyst has access to, for example, timing or power consumption, he may be able to deduce secret information.

Notable methods of cryptanalysis include exhaustive search for the key, which is a risk for all ciphers. Linear cryptanalysis and differential cryptanalysis are general methods for symmetric key cryptography. When cryptography relies on hard mathematical problems, as is usually the case in asymmetric cryptography, algorithms for tasks such as factoring become potential tools for cryptanalysis.

History of cryptography
Main article: History of cryptography

Cryptography has had a long and colourful history. The earliest forms of secret writing required only pen and paper, and are now collectively termed classical cryptography. The two main categories are transposition ciphers, which rearrange the order of letters in a message, and substitution ciphers, which systematically replace groups of letters with others. Classical ciphers tend to leak varying amounts of information about the statistics of the plaintext, and because of this they are easily broken, for example by frequency analysis. Classical ciphers still enjoy popularity today, though mostly as puzzles (see cryptogram).

Early in the 20th century, several mechanical devices were invented for performing encryption, including rotor machines &mdash most famously the Enigma cipher used in World War II. The ciphers implemented by these machines brought about a significant increase in the complexity of cryptanalysis. The various attacks on Enigma, for example, succeeded only after considerable effort.

With the advent of digital computers and electronics, very complex ciphers could be implemented. A characteristic of computer ciphers is that they operate on binary strings unlike classical and mechanical schemes, which use an alphabet of around 26 letters, depending on the language. Computer ciphers are also much more resistant to cryptanalysis; few are susceptible to a ciphertext-only attack.

Extensive academic research into modern cryptography is relatively recent &mdash it only began in the open community during the 1970s with the specification of DES and the invention of RSA. It is well that much progress has been made in a short time; popular applications such as the Internet and mobile phones have repositioned cryptography, historically the sole province of a few groups with exceptional needs for secrecy, into a mainstream technology on which millions rely.

As well as noting lessons from its history, cryptographers are also careful to consider the future. Moore's law is routinely taken into account when specifying key-lengths, and the potential effects of quantum computing have already been considered. Note also quantum cryptography.

Secure communications
See also: Information security

Cryptography is commonly used for securing communications. Four desirable properties are:


 * 1) confidentiality, also known as secrecy: only an authorised recipient should be able to extract the contents of the message from its encrypted form. Otherwise, it should not be possible to obtain any significant information about the message contents.
 * 2) integrity: the recipient should be able to determine if the message has been altered during transmission.
 * 3) authentication: the recipient should be able to identify the sender, and verify that the purported sender actually did send the message.
 * 4) non-repudiation: the sender should not be able to deny sending the message.

Cryptography can provide mechanisms to help achieve all of the above. However, some goals aren't always necessary, practical or even desirable in some contexts. For example, the sender of a message may wish to remain anonymous; clearly non-repudiation would be inappropriate.

Symmetric key cryptography
Main article: Symmetric key algorithm

Symmetric key ciphers use the same key for encryption and decryption, or a little more precisely, the key used for decryption is "easy" to calculate from the key used for encryption. Other terms include "private-key", "one-key" and "single-key" cryptography.

Symmetric key ciphers can be broadly grouped into block ciphers and stream ciphers. Stream ciphers encrypt one bit at a time, in contrast to a block cipher, which operates on a group of bits (a "block") of a certain length all in one go. The block ciphers DES, IDEA and AES, and the stream cipher RC4, are among the most well-known symmetric key ciphers.

Other cryptographic primitives are sometimes classified as symmetric cryptography:
 * Cryptographic hash functions produce a hash of a message. While it should be easy to compute, it must be very difficult to invert (one-way-ness, though other properties are usually needed as well). MD5 and SHA-1 are well-known hash functions.
 * Message authentication codes (MACs), also known as keyed-hash functions, are similar to hash functions, except that a key is needed to compute the hash. As the name suggests, they are commonly used for message authentication. They are often constructed from other primitives, such as block ciphers, unkeyed-hash functions or stream ciphers.

Public key cryptography
Main article: Public key cryptography / Asymmetric key algorithm

Symmetric key encryption has a troublesome drawback &mdash two people who wish to exchange confidential messages must share a secret key. The key must be exchanged in a secure way, and not by the means they would normally communicate. This is usually inconvenient, and public-key (or aysmmetric) cryptography provides an alternative. In public key encryption there are two keys used, a public and a private key, for encryption and decryption respectively. It must be "difficult" to derive the private key from the public key. This means that someone can freely send their public key out over an insecure channel and yet be sure that only they can decrypt messages encrypted with it.

Public key algorithms are usually based on hard mathematical problems. RSA, for example, relies on the (conjectured) difficulty of factorisation. For efficiency reasons, hybrid encryption systems are usually used in practice; a key is exchanged using a public-key cipher, and the rest of the communication is encrypted using a symmetric-key algorithm (which is typically much faster). Elliptic curve cryptography is a type of public-key algorithm that may offer efficiency gains over other schemes.

Assymetric cryptography also provides mechanisms for digital signatures, which are a digital equivalent of physical signatures for paper documents, for example DSA and ElGamal.

Other Topics
See also: Topics in cryptography

The security of all practical encryption schemes remains unproven, both for symmetric and asymmetric schemes. For symmetric ciphers, confidence gained in an algorithm is usually anecdotal &mdash e.g. no successful attack has been reported on an algorithm for several years despite intensive analysis. Such a cipher might also have provable security against a limited class of attacks. For asymmetric schemes, it is common to rely on the difficulty of the associated mathematical problem, but this, too, is not provably secure.

Surprisingly, cryptography does have provably secure ciphers &mdash the one time pad, for example. However, such schemes require keys as long as the plaintext, so are almost always too cumbersome to use.

When the security of a system fails, it is rare that a weakness in the cryptographic algorithms is exploited. More often, it is a mistake in the implementation, the protocols used or some other human error. The study of how best to implement and integrate cryptography is a field in itself, see: cryptographic engineering, security engineering and cryptosystem.

Cryptography can be used to implement some remarkable protocols: zero-knowledge proof, secure multiparty computation and secret sharing, for example.

Warnings
Myths and misunderstandings about cryptography are widespread, and there is an abundance of insecure cryptographic software on the market, sometimes referred to (perjoratively) as snake oil. Readers, buyers, and users should therefore exercise substantial caution when selecting books and products; self-education is advised.