Mark As Completed Discussion

3. What is asymmetric key encryption and how it is different from the symmetric key encryption?

To understand asymmetric key encryption, let's first take a look at what symmetric key encryption is.

Symmetric Key Encryption

With symmetric key encryption, the big idea is that you use the same key for encrypting and decrypting your code. Consider the following example where I've written an encrypted message:

Cojrgclo zloo suhscuh brx wr gucfn wkh lqwhuylhz.

I have encrypted it by shifting the original alphabet three times in the forward direction (using ‘c’ for ‘a’ and ‘z’ for ‘w’). In this case, 3 is my encryption key. Therefore, this message can be decrypted by using the same key (i.e. 3), but in the backward direction. Do that and you will get my original message:

AlgoDaily will prepare you to crack the interview.

This is the symmetric key encryption where a single key is being used for encryption and decryption. However, nowadays, cracking symmetric key encryption is rather easy. Therefore, blockchain incorporates public key cryptography via asymmetric key encryption.

Asymmetric Key Encryption

Asymmetric key encryption uses a pair of two keys: a public and a private key. A public key is available for everyone, whereas the private key is known to the owner only. This means that everyone involved in the network holds a pair of public and private keys. Their public keys will be available for everyone, but their private keys will be known to them only.

Suppose that participant A from the United States wants to do a transaction on a blockchain network with a participant Z who is in Asia. A will send the transaction data to Z, by first encrypting it with its own private key and then encrypting it again with the public key of the Z. Following that, Z can decrypt it using their own private key and then decrypt it again using the public key of the A. This double encryption and decryption will ensure that only Z can read the data and only A could have sent this data.