## Introduction to ElGamal Encryption

ElGamal cryptosystem can be defined as the cryptography algorithm that uses the public and private key concept to secure the communication occurring between two systems. It can be considered as the asymmetric algorithm where the encryption and decryption happen by the use of public and private keys. In order to encrypt the message, the public key is used by the client while the message could be decrypted using the private key on the server end. This is considered as one of the efficient algorithms to perform the encryption and decryption as the keys are extremely tough to be predicted. The sole purpose of introducing the signature in message transaction is to protect it against MITM which could be very effectively achieved by this algorithm.

### ElGamal Encryption Algorithm with Example

** **The soul concept of this algorithm method is to make it nearly impossible to calculate the encryption approach even if certain important information is known to the attacker. It is mainly concerned about the difficulty to leverage the cyclic group in order to find the discrete logarithm.

It will be very easy to understand using a simple example. Suppose even if the value like g^a and g^b are the values that are known to the attacker, the attacker will find it extremely difficult to find out the value of g^ab which is nothing but the cracked value.

In order to understand the entire scenario, we need to go in a stepwise manner on how the encryption and decryption of messages happen actually. We will be considering the example of two peers who are willing to exchange data in a secure manner by leveraging the ElGamal algorithm. Let’s suppose user1 and user2 want to exchange the information secretly in that case the following procedure will be followed.

#### Step 1: Generation of the public and private keys.

- The user1 will try to select a very long or large number x and meanwhile, he will also choose a cyclic group Fx. From this cyclic group, he will be further choosing another component b and one more element c. The values will be selected in the manner that if passed through a particular function, the outcome will be equivalent to 1.
- Once the value selection phase is over, a value will be calculated that will be further used to generate the private key. By applying the formula fm=b^c, the value will be calculated. In the current scenario, the user1 will select F, fm = b^c, a, b as their public key while the values of a will be saved as the private key which will be further used as the private key.

#### Step 2: User2 will encrypt the data using the public key of User1.

- In order to begin the encryption of the message, there are certain values that user2 needs to pick. The user2 will also require to pick one of the values p from the cyclic group. The cyclic group will be the same as it was for user1. The value should be picked in a manner so that Inc passes with a in the particular function will generate the outcome 1.
- Know the user2 will be generating some other values that will be used to encrypt the message using the public key. The value generates will be Pm=b^p. The other revalue b^c will be equal to b^ap. The outcome of this computation will be multiplied to the other value Z in order to get closer to the encryption method. Eventually, the value will be sent using the outcome of computations on b^p,Z*b^ap.

#### Step 3: Decryption of the message at user1 end.

- The user1 will then use the computation of the values that have been picked in the first and second phase in order to identify the appropriate number which will be used to decrypt the encrypted message. The User1 will be processing b^ap and then the outcome will be used to divide the by Z in order to get the decrypted value. The decrypted value is something that is that was encrypted in the second phase.
- In the above scenario, the user1 has initiated the process by calculating the private and public key which is the soul of the algorithm. The key is further used by the user2 in the second step in order to encrypt the method.
- The message is encrypted in a manner so that they value computed in that initial phase could be leveraged to decrypt the message as well. In the third step, it could be witnessed that after diving the entire value with the number that is computed in the third step itself totally decrypts the message making it readable for the end-user. The same approach is followed every when the urge to pass the message securely occurs.

### Conclusion- ElGamal Encryption

ElGamal algorithm is used in encryption and decryption which is mainly considered for its capability to make the key predictions extremely tough. Being the asymmetric algorithm, it uses the mechanism of private and the public key making the key predictions even tougher. All the application that is looking not to just rely on channel encryption to protect their data can find it sheer helpful to implement this algorithm in the program. In addition to the security on the application level, this algorithm is also considered very optimal to deal with the data transmission over the private or public network.

### Recommended Articles

This has been a guide to EIGamal Encryption. Here we also discuss the introduction and EIGamal Encryption algorithm with an example. You may also have a look at the following articles to learn more–

4.5 (4,066 ratings)

View Course