# Cryptography Part II

--

The previous article gave a glimpse of basic cryptography encryption between our computers and websites we visit. Now, we explore deeper.

# Introduction

In the earlier article we explored a way of encrypting information. However, such techniques are extremely outdated and easily broken. Modern encryption algorithms have risen far higher and pose a serious challenge even to the best computers known to humankind.

“With the right quantum computer, AES-128 would takeabout 2.61*10¹² yearsto crack, while AES-256 would take 2.29*10³² years. For reference, the universe is currently about 1.38x10¹⁰ years old, so cracking AES-128 with a quantum computer would take about 200 times longer than the universe has existed.” —https://www.ubiqsecurity.com/blog/128bit-or-256bit-encryption-which-to-use/

# Types of Encryption

Encryption algorithms are mainly mathematical formulas, and the Decryption algorithm is just the mathematical reverse. For example, if the encryption is an addition, the decryption might involve subtraction.

There are mainly two types of encryption algorithms. Symmetric and Asymmetric.

# Symmetric Encryption

Symmetric Encryption is a function where the encryption formula and decryption formula are both the same. For example, a XOR operation leads to Symmetric encryption.

A XOR operation is a Boolean arithmetic operation that results as such:

Thus, the Encryption and Decryption would be as follows:

Here, the same XOR operation with the same Key is used for Encryption as well as Decryption. Thus, it is called a Symmetric Encryption algorithm.

# Asymmetric Encryption Algorithm

Asymmetric Encryption Algorithms are ones whose Encryption and Decryption differ by Operations or Keys. Asymmetric algorithms usually use a Public Key — Private Key pair. The plain text is encrypted using the receiver’s Public key while the cipher text is decrypted using the receiver’s Private Key.

In such algorithms, the public key is shared, and the private key remains confidential for every user themselves. Thus, anyone with my public key can send me a message but only I can read the contents with my private key.

For example, RSA Algorithm:

It consists of 3 Steps:

## 1. Key Generation:

The Private Key stays with the Receiver. The Public is sent to the Sender.

## 2. Encryption

## 3. Decryption

Thus, the original Message is recovered from the Cipher. However, without the Private Key it would be almost impossible to guess the values of d and n that could recover for us the actual Plain text.

# Advantages

# Symmetric Encryption Algorithm

Symmetric Encryption algorithms benefit us with their speed of encryption. These are usually easy to implement, faster to use. These are used for most common applications.

Some prominent examples of Symmetric Encryption algorithms are DES, 3DES and the highly acclaimed AES (Advanced Encryption Standard).

# Asymmetric Encryption Algorithm

Asymmetric Encryptions often tend to be complex mathematical operations and can be extremely difficult to process. They also come with the greatest amount of security and are extremely hard to crack or guess.

Some Prominent examples of Asymmetric Encryption are RSA, Elliptic Curve Cryptography, etc.

# Disadvantages

# Symmetric Encryption

Symmetric Encryption algorithms suffer due to the key sharing part. If any sniffer is listening to the communication while the key is being shared, they can decrypt and alter the whole conversation. Because it uses the same key for encrypting and decrypting, the sniffer can detect any packet, modify it, re-encrypt it as if it was from the actual source and resend it. The receiver would have no way to recognize a mutilation attempt.

# Asymmetric Encryption

Asymmetric Encryption while Strong and complex, does add too much to the processing cost. It is processing intensive and slow. These cannot be used for real-time communication.

Another disadvantage for Asymmetric key is there is no confirmation of who sent the message. There are no signatures, and the message is encrypted with our Public key which is pretty much available to anyone on the internet.

# Work-Around

Hybrid Encryptions provide a work around for the disadvantages of both kinds of encryption.

Nowadays, the Key sharing occurs via asymmetric encryption and then the actual messages are sent using symmetric key encryption. This ensures that the Key remains confidential and thus the encryption is safe (Kerchoff Law).

*Kerchoff Law: a cryptosystem should be secure, even if everything about the system, except the key, is public knowledge.*

The problem of sender identity in Asymmetric encryption is solved by using a Private Key — Public Key pair to Encrypt. In this method, a sender must use his own Private Key and the Receiver’s Public combined to encrypt a message.

The Receiver will then decrypt the message using his own Private Key and the sender’s Public Key.

So far, we have discussed the parts of Cryptography that allows for Encryption and Decryption. However, there are techniques that can only Encrypt and never Decrypt back. What are these and how these are used, on the next article.