How does symmetric encryption work?

NicolasBrondinBernard

Author
@NicolasBrondinBernard

Definition, concepts, security, vulnerabilities—a quick tour of the topic, while staying as understandable as possible!

Article published on 24/01/2022, last updated on 10/08/2026

Since the dawn of time, men have fought battles, in all their forms: physical, armed, non-violent, digital,...

And since antiquity, the communication of strategic information has been one of the pillars for tipping the balance in favor of victory.

But these communications, when intercepted, can be dangerous, even fatal.

This is why encryption has been used for many centuries, and notably symmetric encryption, the first recorded use of which dates back to 1500 BC, in Mesopotamia.

Concept

Symmetric encryption, even in its most basic form, is based on two tools: An encryption/decryption algorithm, and a key.

It works as follows:

The participants agree on a common encryption algorithm (often inherent to the system used to communicate). One of the participants generates a key, which they will distribute only to the other participants in the discussion, discreetly (but not securely).

Once the key is received, each message will be encrypted using the algorithm coupled with the key, and decrypted in the same way, so that only participants with access to the key can read and send messages.

Algorithms

There are several families of symmetric encryption algorithms, here they are in their simplest forms:

Mono-alphabetic substitution

The first family of algorithms simply consists of replacing each letter of the text with a corresponding letter, taken from a "correspondence table".

One of the best-known algorithms (although it offers no security today), is the "Caesar Cipher".

This consists of shifting each letter a certain number of places in the alphabet, and this number will serve as the key for encrypting and decrypting.

For the key "1", each letter will be shifted 1 place to the right (a becomes b, b becomes c, c becomes d, etc...). The example below represents a text encrypted with the Caesar cipher, and the key "13", this is what is called ROT13.

Example: "Hello World !" => "Uryyb jbeyq !"

Poly-alphabetic substitution

The main problem with the "mono-alphabetic" family is that each letter of the original text has only one equivalent letter in the encrypted text.

In other words, if you know the original language, then by looking at the distribution of letters, the code is easily decipherable.

This is why poly-alphabetic substitutions exist, meaning that the algorithm will not only take the key as a reference, but also the position of the letter in the original sentence.

This is the basis of how the German encryption machine "Enigma" worked, used during World War II and "cracked" by Alan Turing and his team at "Bletchley Park"

Example: "Hello World !" => "flqib shgpm !"

Permutation

Simple permutation is a very easy algorithm to decipher, but it does bring about the "breaking" of the text's structure, by shifting spaces and letters and thus destructuring words.

The example below simply swaps each pair of letters:

Example: "Hello World !" => "eHll ooWlr d!"

Hybrid (Substitution + Permutation)

As we have seen, each of the previous families offers us additional security for the encrypted information, which means that in practice, a hybrid family will be implemented:

Poly-alphabetic substitution, permutations, and a complex private key are combined in order to have a solid encryption/decryption solution.

Example: "Hello World !" => "JsOL d$ aNdls"

In practice

AES

There are dozens of symmetric encryption algorithms used in the industry, but if we had to know only one, it would surely be the AES algorithm.

AES stands for "Advanced Encryption Standard" and is an algorithm that exists in several versions for different uses. It is used, for example, to encrypt data transmitted over Wi-Fi, and the HTTPS protocol.

I won't go into the details of the AES implementation as it is very complex, but here's what you need to remember:

Unlike the basic algorithms presented above, it does not encrypt simple sentences, but directly encrypts data in the form of bit matrices, and the associated keys generally consist of 128, 192, or 256 bits.

If you want to know more, I invite you to read this article to understand exactly how AES works: https://securityboulevard.com/2020/04/advanced-encryption-standard-aes-what-it-is-and-how-it-works/

Advantages/Disadvantages

By using a sufficiently strong algorithm and a sufficiently complex key, encryption algorithms like AES are very fast to execute, which makes it possible to have great strength while remaining efficient in encryption and decryption.

For reference, brute-forcing information encrypted with AES-256 would take about 27,337,893,038,406,611,194,430,009,974,922,940,323,611,067,429,756,962,487,493,203 years.

Nevertheless, symmetric encryption algorithms have a major flaw: the sharing of the private key. If the key is intercepted during sharing, then all communications can be intercepted.

This is why some systems (such as SSL) use both asymmetric encryption to transfer the key, and encrypt the final data symmetrically.

Summary

Symmetric encryption works as follows: Private key generation, key sharing, encryption and decryption with the same key.

This system is the fastest but also has a flaw during the transfer of the private key.

Symmetric encryption is therefore sometimes used together with asymmetric encryption, as is the case with SSL, whose packets are encrypted with the AES algorithm.


Farai Gandiya sur Unsplash

Finished reading this article?
Our newsletter

No spam. Only free content, news, and ever more resources to level up your skills!

Join +1500 developers

Comments (0)

to leave a comment

No comments yet