Modified ElGamal Elliptic Curve Cryptosystem using Hexadecimal Representation

Data encryption is an important issue and widely used in recent times to protect the data over internet and ensure security. One of the mostly used in public key cryptographies is the Elliptic Curve Cryptography (ECC). A new modified method has been proposed to encrypt/decrypt data using ECC in this paper. This modification converts each character of the plaintext message to its hexadecimal ASCII value of two digits, then separates the value into two values. After that, the transformation is performed on each value into an affine point on the Elliptic Curve E. This transformation is used to modify ElGamal Elliptic Curve Cryptosystem (EGECC) to encrypt/decrypt the message. In modified method, the number of doubling and adding operations in the encryption process has been reduced. The reduction of this number is a key point in the transformation of each character into an affine point on the EC. In other words, the modified method improved the efficiency of the EGECC algorithm. Moreover, using the hexadecimal ASCII value makes EGECC more secure and complicated to resist the adversaries. Modified ElGamal Elliptic Curve Cryptosystem using Hexadecimal Representation


Introduction
Elliptic Curve (EC) has been introduced and used for the first time in cryptography by Miller 1 and Koblitz 2 .Elliptic Curve Cryptography (ECC) depends on the hardness of the Elliptic Curve Discrete Logarithm Problem (ECDLP).So, the adversaries are not able to attack ECC and solve ECDLP which is infeasible to be solved and has strength security against all kinds of attacks.For this reason, most of the modern cryptographic systems are established based on the EC 3,4 .ECC can be defined over two types of fields: one is the prime field F p which is suitable for the software applications and the other is the binary field which is suitable for the hardware applications 5 .ECC has some advantages that make it widely used these days such as small storage capacity, faster computations and reduction of the power consumption 13 .These advantages make ECC is a more suitable to be used in smart cards, wireless communications, portable devices, and e-commerce applications 14 .ECC offers the same security level like RSA and ElGamal algorithms with shorter key length which makes it works with a little amount of memory and low power 11,12 .As a result of these advantages of elliptic curve, several studies have been presented by many researchers.For instance, Williams Stallings in 2011 introduced study about ECC in his book 5 .Hongqiang in 2013 proposed an approach to generate a random number k and sped up computing the scalar multiplication in the encryption and decryption processes 6 .An implementation of ElGamal ECC for encryption and decryption a message is also proposed by Debabrat Boruah in 2014 7 .Meltem Kurt and Tarik Yerlikaya in 2013 presented a modified cryptosystem using hexadecimal to encrypt data.Their study depended on Menezes Vanstone ECC algorithm by adding additional features 8 .Maria Celestin and K. Muneeswaran in 2013 used decimal ASCII value to represent the characters.These characters are transformed into points on the elliptic curve through multiplying their values by a random point on the Elliptic Curve 9,10 .
In this work, a modified method that uses ElGamal ECC for encryption and decryption of the plaintext has been proposed.The modified method uses the hexadecimal ASCII value to represent each character.This representation reduces points doubling and addition which are required to transform the characters into points on the elliptic curve.As a result, further from speeding up the computations can be achieved.
This paper is organized as follows.Section 2 presents a synopsis of the mathematical background to explain elliptic curve E over prime field.Section 3 briefly reviews ECC algorithm and ElGamal protocol.Section 4 explains the modified cryptosystem for encryption and decryption.Section 5 explains a simple example of the proposed method.The comparison between the proposed method and Maria method is discussed in the Section 6.Finally, section 7, displays the conclusion and the advantages of the proposed method.

Introduction to Elliptic Curve over Prime Field
where A B F p , ∈ and satisfy the condition 4 27 The set of all points (x,y) that satisfy an elliptic curve Equation 1, with a special point O (that is called a point at infinity), forms an elliptic curve group E(F p ) 15,16 .

Point Addition
Suppose p = (x 1 , y 1 ) and Q = (x 2 , y 2 ), where P ≠ Q, are two points lie on an elliptic curve E defined in Equation 1.The sum P + Q results a third point R which is also lies on E. To add two points on E there are some cases on the coordinates of the points P and Q .These cases are given as follows 8 : Then sum of P and Q in this case is defined by where λ = − ( ) − ( ) (3)

Point Doubling
Let p = (x 1 , y 1 ) be a point lies on E .Adding the point P to itself is called doubling point on an elliptic curve E 17,18 .In other words where

Scalar Multiplication (Point Multiplication)
Suppose k is an integer and p = (x 1 , y 1 ) is a point lies on E .The scalar multiplication can be defined by (10)   In other words, adding a point P to itself K times 17 .
A scalar multiplication kP can be computed using the point doubling and point addition laws.For example, the scalar multiplication 9P can be calculated by the following expression:

ElGamal Elliptic Curve Cryptosystem
In 1987, Koblitz proposed analogues of ElGamal public key cryptosystem based on the elliptic curve over a finite prime field.The first step of ElGamal elliptic curve cryptosystem converts the plaintext message m to a point P m on the elliptic curve E(F p ).Each party chooses a private key randomly from the interval [1, p − 1] ; n A for user A and n B for user B, then computes a public key by multiplying the private key by the base point To encrypt the message P m ; the sender chooses a random number k and multiplies it by the receiver public key P B then adds the result to the message P m and send it with kG So, the ciphertext message will be { ., .} {( , ),( , . To decrypt the ciphertext, the receiver multiplies kG by his private key n B and subtracts the result from P m +k.P B to get the plaintext P m as follows 9,15 : ( . ) .( . ) . .

The Modified Cryptosystem
The Modification of ElGamal Elliptic Curve Cryptosystem (MEGECC) has been presented in this section.This modification depends on the speeding up of the computation on EGECC using hexadecimal ASCII values by reducing the number of doubling and addition operations needed.The domain parameters (that is {A,B,p,G}) are public for all entities.Suppose A and B are two users wishing to communicate and exchange the information using MEGECC over insecure channel.Let us choose the user A as the sender who wants to encrypt and send a message m to the user B (the receiver).Every entity, namely A and B, need to choose a private key.The private keys, n A and n B are positive integers chosen randomly from the interval [1, p − 1].The public keys for the users A and B can be generated respectively as follows: The basic idea of the contribution in this work depends on using the hexadecimal ASCII value to reduce the number of doubling and addition operations.Suppose user A wants to send a message m to user B. Firstly, he converts each character in the message m into hexadecimal ASCII value of two digits (h 1 h 2 ) 16  and to compute the ciphertext message as follows: where C1 and C2 are two points lie on E. The set of points {C1,C2} is sent to the user B.
Upon receiving the ciphertext {C1,C2} by user B, the decryption process will be started.User B first needs to multiply his private key n B by A's public key P A to get the secret key K K= n B P A then subtracts K from C1 and C2 to get and .The last step is to convert d 1 and d 2 to hexadecimal h 1 and h 2 respectively, and write them as, (h 1 h 2 ) 16 then find the match character from the hexadecimal ASCII table.Repeat the previous procedure for each character in the message m.
One of the advantages of the modified cryptosystem is that the solution of P d G h 1 1 = .and P d G h 2 2 = .is not difficult for the receiver and will not take a long time because the largest value for d 1 and d 2 in decimal is 15 (the maximum digit in hexadecimal is F = 15) but it is very difficult for the adversary because he can't know the private key n B and the prime number p will be chosen as a large number.

The secret key will be K n P n P n n G A B B A A B
= = = . . . .

Implementation Example
Assume that user A and user B are agreed to use the elliptic curve where satisfy the condition = 4(1) 3 +27(3) 2 = 4+243 = 247 mod 31 = 30 ≠ 0, then the points of the elliptic curve are shown in Table 1.
Let the point (1,6) be chosen as the base point G; the order of our elliptic curve is 41 and it is a prime number, so we can choose any point as the base point or generator 19 .So, the domain parameters are .If user A wants to send the message 'Hello' to user B, he should first convert each character in the message 'Hello' to the hexadecimal value from the ASCII table, then separates each value into two values and converts them to decimal values.P A and P B will be exchanged and be public for both users A and B.
In the proposed algorithm, solving P d G h 1 1 = .for d 1 and d 2 is needed, it is not difficult and will not take a long time because the largest value for d 1 and d 2 in decimal is 15 (the maximum digit in hexadecimal is F = 15).The same processes for the other characters "ello" should be repeated.

Results and Discussions
In this section, a comparison between the proposed method in this paper and the proposed method by Maria Celestin and K. Muneeswaran 9 is done on the plaintext "Hello" with consider of doubling operation ( ) 2G G G = + is same as addition operation (G+Q).Take the character "H" as an example; in the proposed method the following operations are required then calculate 4G=2(2G) and 8G=2(2(2G)), so the total operations are 2D+3D=5 operations.Whereas, in Maria method 'H' → (72) ASCII , then calculate 72G = 2(2(2(2(2(2G))+G))) and the total operations are 6D+1A=7 operations (D for doubling and A for addition).So, in the proposed method the character "H" needs 5 operations where in Maria Method it needs 7 operations.Table 2 summaries the operations that are required for each method to transform the plaintext "Hello" into affine points on the EC.Table 2 shows that the proposed method is better than Maria method.In this method, to transform the character "H" which has the hexadecimal ASCII value 48 into an affine point on the EC we need 5 operations.Whereas, in Maria method the decimal ASCII value for "H" is 72, so the sender needs 7 operations to do the transformation.The total operations that is needed for the plaintext "Hello" is 34 in the proposed method and 45 in Maria method and the difference between the two methods will be increased if the size of the plaintext is increased.Figure 1 represents a column chart graph for the arithmetic operations (doubling and adding) that are required in both methods for the plaintext "Hello".
Table 3 shows the number of doubling and addition operations that are needed to transform plaintexts of different sizes into affine points on the EC in the proposed method and Maria method and the percentage of improvement.
To calculate the improvement percentage for the plaintext "Hello", subtracts number of operations in the proposed method from number of operations in Maria method and divide by number of operations in Maria method then multiply by 100% as follows: Improvement percentage for "Hello" = It is clear from Table 3 that the proposed method is better than Maria method and the percentage of improvement increases when the plaintext size increases.

Conclusions
Elliptic Curve Cryptosystem (ECC) is one of the most efficient cryptosystems that is used to encrypt/decrypt data; it is secured against all kinds of attacks.The short key size of ECC gives it strengthened security compared to other cryptosystems like RSA with the same security level.This advantage leads to fast computations, less memory and power consumption, and saving bandwidth.These advantages make ECC efficient to be used in some applications like e-commerce, smart cards, chip cards, and portable devices.
In our work, a new efficient method has been proposed to encrypt/decrypt any text using the hexadecimal ASCII value for each character.The main contribution is to reduce the number of doubling and addition operations as shown in Table 2 and Table 3 that user A needs to transform the plaintext into an affine points on the EC  =and speed up the encryption process.
In the modified method, user B can solve the small values of the discrete logarithm problems P d G h 1 1 = .easily.These computations not need long time because the largest value for d 1 and d 2 in decimal is 15 that corresponds to the maximum digit in hexadecimal F = 15, but at the same time it is very difficult for the adversary because it is difficult for him to know n A and n B .Moreover, in the modified method, user A does not need to send kG every time, he sends the ciphertext message only, because both users A and B working on their private keys n A and n B .Separating each character of the plaintext into two points on the EC and using the hexadecimal ASCII value for the transformation make modified method more secure and difficult for the adversaries.

=P
P h 1 and in similar way for C2 C K C n P P n P n n G to solve the following equations for d 1 and d 2 by using Elliptic Curve Discrete Logarithm Problem (ECDLP) where P h 1 , P h 2 , and G are known.
public key P A =n A .G. the public key P B =n B .G.

Figure 1 .
Figure 1.Column chart for doubling and adding operations for the plaintext "Hello".

h 2 2
then separates the value into two values (h 1 , h 2 ) 16 and converts each value of h 1 and h 2 to decimal values d 1 and d 2 respectively 8 .The scalar multiplication of the base point G on E by each value of d 1 and d 2 can be computed to transform the values to points on E by the following formulas: Rewrite the value (h 1 h 2 ) 16 as (h 1 , h 2 ) 16 then convert it 4.1.2.1 User A• Convert each character of the message m to hexadecimal ASCII value of two digits (h 1 h 2 ) 16 .•

Table 2 .
The required doubling and addition operations for the plaintext "Hello"

Table 3 .
The required operations and improvement percentage for different plaintexts