# What is Encryption?

According to Cryptography,encryption is the process of encoding information. This process converts the original representation of the information, known as plaintext, into an alternative form known as ciphertext. Only authorized parties can decode a ciphertext back to plaintext and access the original information. In other words encryption is the method to encode a data/plaintext in such a way that only an authorized person can access that data. it is used to secure the confidential data from others.

# Symmetric Key Algorithm

What is symmetric key algorithm?

Symmetric key algorithm,is a type of encryption where only one key (a secret key) is used to both encrypt and decrypt electronic information. The entities communicating via symmetric encryption must exchange the key so that it can be used in the decryption process. This encryption method differs from asymmetric encryption where a pair of keys, one public and one private, is used to encrypt and decrypt messages.

## Need of Symmetric key algorithm?

symmetric key algorithm is the oldest method to encrypt data,it is faster and more efficient than asymmetric encryption, which takes a toll on networks due to performance issues with data size and heavy CPU use.

Uses:

• Payment applications, such as card transactions where PII needs to be protected to prevent identity theft or fraudulent charges.
• Validations to confirm that the sender of a message is who he claims to be.
• Random number generation or hashing.

The two types of traditional symmetric ciphers are Substitution Cipher and Transposition Cipher. The following flowchart categories the traditional ciphers:

Substitution Cipher:
Substitution Ciphers are further divided into Mono-alphabetic Cipher and Poly-alphabetic Cipher.

Mono-alphabetic Cipher –
In mono-alphabetic ciphers, each symbol in plain-text (eg; ‘o’ in ‘follow’) is mapped to one cipher-text symbol. No matter how many times a symbol occurs in the plain-text, it will correspond to the same cipher-text symbol. For example, if the plain-text is ‘follow’ and the mapping is :

• f -> g
• o -> p
• l -> m
• w -> x

The cipher-text is ‘gpmmpx’.

Types of mono-alphabetic ciphers are:

Mono-alphabetic ciphers a thus divided in three as shown above in the flowchart:

Additive Cipher (Shift Cipher / Caesar Cipher) –
The simplest mono-alphabetic cipher is additive cipher. It is also referred to as ‘Shift Cipher’ or ‘Caesar Cipher’. As the name suggests, ‘addition modulus 2’ operation is performed on the plain-text to obtain a cipher-text.

C = (M + k) mod n
M = (C — k) mod n

where,
C -> cipher-text
M -> message/plain-text
k -> key

The key space is 26. Thus, it is not very secure. It can be broken by brute-force attack.

Multiplicative Cipher –
The multiplicative cipher is similar to additive cipher except the fact that the key bit is multiplied to the plain-text symbol during encryption. Likewise, the cipher-text is multiplied by the multiplicative inverse of key for decryption to obtain back the plain-text.

C = (M * k) mod n
M = (C * k-1) mod n

where,
k-1 -> multiplicative inverse of k (key)

The key space of multiplicative cipher is 12. Thus, it is also not very secure.

Affine Cipher –
The affine cipher is a combination of additive cipher and multiplicative cipher. The key space is 26 * 12 (key space of additive * key space of multiplicative) i.e. 312. It is relatively secure than the above two as the key space is larger.
Here two keys k1 and k2 are used.

C = [(M * k1) + k2] mod n
M = [(C — k2) * k1–1 ] mod n

Now, let’s study about poly-alphabetic cipher.

Poly-alphabetic Cipher –
In poly-alphabetic ciphers, every symbol in plain-text is mapped to a different cipher-text symbol regardless of its occurrence. Every different occurrence of a symbol has different mapping to a cipher-text. For example, in the plain-text ‘follow’, the mapping is :

f -> q
o -> w
l -> e
l -> r
o -> t
w -> y

Thus, the cipher text is ‘qwerty’.

Types of poly-alphabetic ciphers are:

auto-key cipher

playfair cipher

hill cipher

rotor cipher

vigenere cipher

Transposition Cipher:
The transposition cipher does not deal with substitution of one symbol with another. It focuses on changing the position of the symbol in the plain-text. A symbol in the first position in plain-text may occur in fifth position in cipher-text.

Two of the transposition ciphers are:

# Asymmetric key algorithm

## What is asymmetric key algorithm?

Asymmetric cryptography is a branch of cryptography where a secret key can be divided into two parts, a public key and a private key.The public key can be given to anyone, trusted or not, while the private key must be kept secret (just like the key in symmetric cryptography).

Decryption:
The process of changing the ciphertext to the plaintext that process is known as decryption.
Asymmetric is a form of Cryptosystem in which encryption and decryption are performed using different keys-Public key (known to everyone) and Private key (Secret key). This is known as Public Key Encryption.

Example:
Public keys of every user are present in the Public key Register. If B wants to send a confidential message to C, then B encrypt the message using C Public key. When C receives the message from B then C can decrypt it using its own Private key. No other recipient other than C can decrypt the message because only C know C’s private key.

Components of Public Key Encryption:

• Plain Text:
This is the message which is readable or understandable. This message is given to the Encryption algorithm as an input.
• Cipher Text:
The cipher text is produced as an output of Encryption algorithm. We cannot simply understand this message.
• Encryption Algorithm:
The encryption algorithm is used to convert plain text into cipher text.
• Decryption Algorithm:
It accepts the cipher text as input and the matching key (Private Key or Public key) and produces the original plain text
• Public and Private Key:
One key either Private key (Secret key) or Public Key (known to everyone) is used for encryption and other is used for decryption

Weakness of the Public Key Encryption:

• Public key Encryption is vulnerable to Brute-force attack.
• This algorithm also fails when the user lost his private key, then the Public key Encryption becomes the most vulnerable algorithm.
• Public Key Encryption also is weak towards man in the middle attack. In this attack a third party can disrupt the public key communication and then modify the public keys.
• If user private key used for certificate creation higher in the PKI(Public Key Infrastructure) server hierarchy is compromised, or accidentally disclosed, then a “man-in-the-middle attack” is also possible, making any subordinate certificate wholly insecure. This is also the weakness of Public key Encryption.

Applications:

• Confidentiality can be achieved using Public Key Encryption. In this the Plain text is encrypted using receiver public key. This will ensures that no one other than receiver private key can decrypt the cipher text.
• Digital signature is for senders authentication purpose. In this sender encrypt the plain text using his own private key. This step will make sure the authentication of the sender because receiver can decrypt the cipher text using senders pubic key only.
• This algorithm can use in both Key-management and securely transmission of data.

# Difference Between Symmetric and Asymmetric Encryption

• Symmetric encryption uses a single key that needs to be shared among the people who need to receive the message while asymmetrical encryption uses a pair of public key and a private key to encrypt and decrypt messages when communicating.
• Symmetric encryption is an old technique while asymmetric encryption is relatively new.
• Asymmetric encryption was introduced to complement the inherent problem of the need to share the key in symmetrical encryption model, eliminating the need to share the key by using a pair of public-private keys.
• Asymmetric encryption takes relatively more time than the symmetric encryption.

# Conclusion

When it comes to encryption, the latest schemes may necessarily the best fit. You should always use the encryption algorithm that is right for the task at hand. In fact, as cryptography takes a new shift, new algorithms are being developed in a bid to catch up with the eavesdroppers and secure information to enhance confidentiality. Hackers are bound to make it tough for experts in the coming years, thus expect more from the cryptographic community!

……………………………………………………………………………………….

Connect with me :)

--

--

--

## More from Akshat Srivastava

An Avid Coder | Cybersecurity Enthusiast | Web developer | Geek | Technical Writer

Love podcasts or audiobooks? Learn on the go with our new app.

## Akshat Srivastava

An Avid Coder | Cybersecurity Enthusiast | Web developer | Geek | Technical Writer