In comparing symmetric and asymmetric algorithms, each type has its advantages and disadvantages.

**Asymmetric algorithms vs symmetric ones**

– Thus, asymmetric encryption algorithms are more “cumbersome” than symmetric ones. If the amount of data is the same, the asymmetric algorithm will take longer to process it. And the key is, respectively, longer than that of the symmetric algorithm.

– Unlike symmetric algorithms, the asymmetric algorithm is a lot harder. Or even nearly impossible to modify. Since the asymmetric algorithm is based on a complex mathematical problem. As for the advantages of asymmetric encryption, it has the ability to exchange public keys via insecure channels.

But asymmetric encryption can be vulnerable to the so-called MITM-attack (“man in the middle”). The point of the attack is that the ”mediator” intercepts and modifies public keys. It simulates the communication of the parties with each other. However, it is not enough to intercept public keys. You also need to calculate private keys. And this is quite a difficult task.

**Hybrid encryption**

Currently, symmetric and asymmetric encryption algorithms are used together. This allows you to combine the benefits of both types of encryption.

For example, * at the first level,* Alice sends Bob a message that contains a session key of symmetric encryption. An asymmetric algorithm is used to send such a message. In this case, the communication channel is protected and the problem of exchange of the session key is solved. Furthermore, the amount of data transmitted is relatively small. This allows you to quickly transfer a symmetric encryption key.

Then, * at the second level*, Alice and Bob have the same keys in their hands, received in a safe way. Alice and Bob encrypt their messages with these keys using symmetric algorithms that have high performance and allow you to encrypt large amounts of data.