# Encoding vs. Compression vs. Encryption

In what ways does encryption differ from proprietary/secret compression schemes and codecs?

• Encryption is the action of protecting data for confidentiality or - if you look at it from the perspective of a cipher - it is one of the two functions of a cipher that permutes the input data. Encryption is not a compression scheme or codec. Sep 24, 2016 at 18:44

OK, there seems to be some confusion with regards to terminology, so let's try to clean that up. I'll try and define things myself, but also provide the more formal Wikipedia definitions.

Encryption. Encryption usually is the process of concealing information solely based on the secrecy of some smaller value, which is called "a key" most of the time. Modern schemes allow for advanced functionality, such as operation on unknown data and guaranteeing the data integrity. Algorithms are not secret with encryption *.
*Except if you experience snake-oil crypto from which you should run. fast.

In cryptography, encryption is the process of encoding messages or information in such a way that only authorized parties can read it.

Compression. Compression algorithms are techniques that exploit redundancy in data to reduce the size of the data representation. This redundancy may be of strict mathematical nature or also of psychological nature (e.g. humans don't hear beyond 20-30kHz so you can strip that out as part of the compression). Compression algorithms aren't meant to conceal data, but may do so, if the compression algorithm is secret - until somebody reverse-engineered the algorithm.

In signal processing, data compression, source coding, or bit-rate reduction involves encoding information using fewer bits than the original representation. Compression can be either lossy or lossless.

Encoding. Encoding is the process of changing data representation. The same data may be represented in different encodings (such as binary, hex, decimal, base64, DER, BER, ...) which aren't (usually) meant to change the data's meaning. Size expansion / reduction may of course be a result of a different encoding. Encodings aren't meant to conceal data, but may do so, if the encoding / decoding alorithm is secret - until somebody reverse-engineers the algorithm.

An encoder is a device, circuit, transducer, software program, algorithm or person that converts information from one format or code to another, for the purposes of standardization, speed or compressions.

Codec. Most of the time a codec is a special compression format, usually paired with a defined encoding.
Wikipedia's definition:

A codec is a device or computer program for encoding or decoding a digital data stream or signal. [...]
A codec encodes a data stream or signal for transmission, storage or encryption, or decodes it for playback or editing.

• It's worth noting that there are two different types of compression. For example, stripping out 20-30Khz because humans can't hear it makes you actually lose some of the data, so it's lossy compression. Something like Huffman encoding, where you can later uncompress it to get the original data back is lossless compression (and also an encoding at the same time!) Sep 25, 2016 at 4:32