 # What is Encryption and how does it work?

Encryption is all around of us, but what are the different types of encryption, how do they work, and where are they used?

Encryption is a method of scrambling data in a way that can’t be read (called ciphertext). One feature of this ciphertext is that it needs to be able to be reversed (unlike hashing algorithms).

## What are the different types of Encryption Algorithms?

There are many different types of encryption algorithms that are used across the world. From how we access websites, to how E2EE apps’ messages are encrypted, even how we watch videos online, everything is encrypted.

These algorithms typically fall into one of two categories: symmetric or asymmetric, which are differentiated by how the encryption and decryption keys are implemented, as well as how many keys are required.

### Symmetric Encryption Algorithms

Symmetric Encryption algorithms are essentially where the same key that was used to encrypt the data is also used to decrypt the data. These sort of algorithms are used when encrypting hard drives, laptops, password managers, etc. This is equivalent to a lock on a chest, where the one key is used to lock and unlock the chest (assuming there’s only one lock on the chest of course).

AES, DES and Triple DES are some common symmetric encryption algorithms. AES (Advanced Encryption Standard) was released in 1998 and supersedes DES (Data Encryption Standard) (first published in 1977) as the standard for symmetric encryption.

Of these symmetric encryption algorithms, there are two types of traditional ciphers known as substitution ciphers and transposition ciphers.

Substitution Ciphers These are ciphers that have a one-to-one mapping of characters to an encoded character. A common example of this is a Caesar cipher or ROT13, where each letter is mapped to another letter in the alphabet. For ROT13, all letters are mapped to the letter 13 characters away. The Caesar cipher follows the same concept, but instead of the “rotation” being 13, it’s any arbitrary value n which is the key.

Example: The ciphertext “Yhxrjnez Frphevgl Vasb vf gur orfg!” would be decoded to “Lukewarm Security Info is the best!” (ROT13).

Transposition Ciphers These are ciphers where the text is reordered without changing the characters themselves. Common examples of these include the “Rail Fence Cipher”, “Skytale” (similar to the Rail Fence Cipher), and “Route Cipher”.

Example: The above example would be written in ciphertext as “SED ERTOE CC”, being decoded to “SECRETCODE” (Rail Fence Cipher).

### Asymmetric Encryption Algorithms

Asymmetric Encryption algorithms use different keys to encrypt and decrypt. The approach behind these is that one key is a public key (publicly known), and one is a private key (kept as a secret to just you). This type of encryption is used to encrypt messages to others, but also as a verification method for message receivers.

RSA (Rivest, Shamir, and Adleman - names after the three creators) is a commonly used asymmetric encryption algorithm found in many online tools such as HTTPS, E2EE Apps, SSH, and GitHub.

RSA Encryption Algorithm The RSA Algorithm is a common public-key encryption algorithm that was created in 1977 and is still used today. With complex maths involved, it utilises the mathematics property where summing two numbers together is easy to do, but finding the two original numbers used to sum is much harder. For example, if the sum is 18, three possible values (or key pairs) would be 6 x 3, 9 x 2, or 18 x 1.