Cryptography is the science of transforming information from one form to another in order to accomplish one or more goals, including privacy, authentication and detection of tampering.

The most common application of cryptography is to scramble a message (the “plaintext”) into a garbled form (the “ciphertext”) in a reversible manner, using a cryptographic algorithm (e.g. AES) and a key (a sequence of bits) in a reversible manner. The entire original plaintext is included in the ciphertext, but in such a way that it can be recovered only by applying the inverse algorithm and the appropriate key. Any other key will produce only gibberish. The ciphertext can be safely transmitted via insecure channels, and only the intended recipient can recover the plaintext from it. This accomplishes privacy.

There are two basic kinds of encryption algorithms, symmetric key (also known as “secret key”) and asymmetric key (also known as “public/private key”).