Skip to main content
. 2020 Sep 10;20(18):5162. doi: 10.3390/s20185162
Algorithm 2: ECC with Hill Cipher
  Input: The image of size 256 ×256 to be encrypted or decrypted.
  Elliptic curve parameters: (Fp)={a,b,p,G}.
  Output: The corresponding cipher image or original image of size 256 × 256.
  1.  Key Generation for ECC (The ECC keys are generated as shown in Section 3.1, Algorithm 1;
  2.  Computing the self-invertible matrix
    (a)  Compute: K1=xG=(k11,k12) and K2=yG=(k21+k22);
    (b)  Compute: K12=I2k11;K21=I2+k11; and k11+k22=0;
    (c)  The 4×4 self-invertible matrix is derived as:
Km=k11k12kk21k22
       where, K11=k11k12k21k22
  3.  Encryption process:
    (a)  Read the image to be encrypted and collect the image pixels separately for the
       channels R, G, and B.
    (b) Group every channel of pixels into 4 × 4 matrices and perform matrix multiplication
       with computed self-invertible matrix.
    (c) The encryption is done using the subsequent formula:
  •         Ci=Km·Pi=k11k12k13k14k21k22k23k24k31k32k33k34k41k42k43k44p11p12p13p14p21p22p23p24p31p32p33p34p41p42p43p44=c11c12c13c14c21c22c23c24c31c32c33c34c41c42c43c44

       where, Km is the self-invertible matrix and Pi is the current input image block to be encrypted;
    (d) Allocate the cipher pixels exactly to the same position as of the corresponding input
       image pixels. A cipher image is formed of size identical to the size of input image.
    (e) Send the cipher image and ECC public key to the receiver. The encryption process
       can be visualized as in Figure 1.
  4.  Decryption process
    (a) Compute the shared secret key from the public key of sender as:
       SSK=nBPA=nBnAG=nAnBG=(x,y)
    (b) Compute the self-invertible matrix exactly as described above using the shared
       secret key.
    (c) Group the cipher pixels into 4×4 matrices and perform matrix multiplication with
       self-invertible matrix from Step 2.
    (d) Allocate the plain text pixels to the same position as of the corresponding cipher
       pixels. The original image is formed back and retrieved as without any intensity loss.