Image Encryption/Decryption using ECC


Total downloads: 11

This is the code which simulates the encryption and decryption of an image using random and private keys in MATLAB. The elliptic curve cryptography is applied to achieve the security of any image before transmitting it to some one so that no other can see the data hidden in the image. At the receiver end the destined user will already have the decryption key used for this. If key is altered, image will not be decrypted.


In the modern scenario, digital images contain important information that required proper security while transmitting from one point to another. The security is valuable for some applications like military picture databases, medical imaging systems, and cable TV broadcasting. Image encryption has many benefits and it is the most popular security scheme of the data or information processing.

Thesis statement ( Image encryption/decryption thesis)

In industries, the confidential images are required security function so that unauthorized access of images is not possible. For the encryption or decryption of images, some public and private keys are used. The private key image encryption/decryption process follows the symmetric cryptographic scheme, whereas asymmetric cryptographic system use in the public key encryption image. In public-key cryptography, the encryption and decryption key are not the same.

The pixel value of the image is first converted into the points and formed groups on to the elliptic curve finite field. All the programs are developed in the MATLAB software, and performance is measured via some security analysis parameters. Simulate the MATLAB script and observed the results with different stages of the encrypting and decrypting process.

Elliptical Curve Cryptography (ECC)

Elliptical curve cryptography is a traditional approach of image encryption and decryption. The ECC (Elliptical Curve Cryptography) is a public key type and uses for those applications in which secure transmission channels are not available. In the image encryption process of ECC(Elliptical Curve Cryptography), the image message is mapping to point on the curve and converting the mapped point into the message types. The quality of the image depends on the pixel value, and the image encryption process mapped these pixel values to point on to the curve.

ECC curve for various points

Figure 1 graph of an elliptical curve [1]

The ECC(Elliptical Curve Cryptography)is a private-public key pair uses for encrypt and decrypt the data. ECC is the asymmetric in nature that means for encryption a public key is used and decryption is retained via private key. The image pixel value is encrypted with the public key and decrypt the cipher text later using the corresponding private key. The image pixel value is converted into the points on the Elliptical curve, then mapping process is applied in the finite filed.

A map table is created with respect to the group of elliptic points. A private key is applied to the mapped points and encrypted the pixel values of the image. Later a corresponding public key is used for the decryption process and retained the actual image from the encrypted image. The image encryption and decryption code are written in the MATLAB.

Mapping Process

The image consists of pixels values for different formats, like a grayscale image contains 8-bit pixel values from 0 to 255. A color image consists of three octet value separately; shows Red, Green, and Blue intensity of color. An image is encrypted with ECC (Elliptical Curve Cryptography)consider each pixel as a message which mapped to point on the predefined elliptical curve. A map table is created with the help of the elliptic group generated first and then points are placed into the 256 groups. ECC(Elliptical Curve Cryptography) is used for the encryption of points after the mapping process of all pixel values of image related to point one by one. Mapping matrix generated after the code is debugging in the MATLAB.

Following snippet of MATLAB code is written for map table generation at


for x=0:p
    for y=0:p
        if mod(y^2,p)==mod((x^3+a*x+b),p)  % This equation must be satisfied by x and y for the given value of a, b and p.
            eccpoints(i,:)=[x y];

% eccpoints_all=[eccpoints; 0 0; 0 0;0 0;0 0;0 0]; 

for j=1:2:range
    for i=N:1:N+255
        x=eccpoints_all(i,:);  % The above points are arranged to map the intensity of pixels of the image.
        maptab(ii,j:j+1)=x;    %
maptab=[x maptab];
save maptab maptab


MATLAB, matrix laboratory, is the software used by engineers and computer scientists for designing algorithms, data analysis, exploration, visualization, application development and many more things. They also do image encryption and decryption using Matlab. The above mention Matlab code for image encryption and decryption will stimulate the same for you.

AES image encryption code algorithm is also implemented with the help of MATLAB platform. AES image encryption Matlab code makes a cipher Image from the original and vice versa.

Encryption and Decryption MATLAB TOOL

  • The image pixel values generated the groups on the elliptical curve with different instant points after the mapping process. A point’s vector is added to the all instant points generated in the group.
  • After the pixel values mapped on to the elliptical curve through the map table and then a public key is generated by the sender which multiplied with each pixel value or point value.
  • The pixel values of the image encrypted using the public key on the elliptic curve points.
  • The mapped or converted image is retained using possession of a secret public key. Each pixel value is retained, and the real image is reconstructed from the encrypted image.

Another technique Logistic map and Arnold cat scrambling are used for the online image encryption and code is available at free-thesis.

Security Analysis

The security analysis of encrypted and decrypted image depends on the various attacks which affect the algorithm. Following analysis based on encrypted and decrypted performance of algorithm performed as

  • Histogram analysis
  • Correlation analysis
  • Entropy analysis
  • Key sensitive analysis

results of encrypted and decrypted via the ECC method

Figure 2 experimental results of encrypted and decrypted via the ECC method

All the performance analysis curves are the plot in MATLAB software, and the mapping table is also generated in the command window of MATLAB.

Advantages of ECC

  • The ECC method is completely sensitive to the secret key so that the encrypted image cannot be decrypted while making some changes in the secret key.
  • The entropy value is higher (8) which provides the optimal length of the code assign to the pixel of an image.
  • The range of the correlation coefficient must be lie between 0 to 1. The adjacent pixels correlation coefficient is maximum for better security.
  • The input image contains some information that can be extracted for the encryption process. So histogram analysis provided the spectrum analysis of information of input and encrypted image.
  • The secret key size is smaller.
  • Low mathematical complexity.
  • High-speed encryption.
  • Brute force attack is impracticable for elliptical curve cryptography due to its logarithmic type of nature


In this work, the ECC(Elliptical Curve Cryptography) algorithm is proposed for the online image encryption and decryption process. ECC (Elliptical Curve Cryptography)is provided the fast encryption and use for high information images. The mapping is performed for the conversion of pixel value into point of an affine elliptic curve over a finite field using the map table. The encryption process is very fast and low complex in nature. The strength of the algorithm is checked by the security analysis function like histogram, key security, and correlation.


  1. Soleymani, Ali, Md Jan Nordin, Azadeh Noori Hoshyar, Zulkarnain Md Ali, and Elankovan Sundararajan. “An image encryption scheme based on elliptic curve and a novel mapping method.” International Journal of Digital Content Technology and its Applications7, no. 13 (2013): 85.
  2. Astya, Dr ParmaNand, Ms Bhairvee Singh, and Mr Divyanshu Chauhan. “Image encryption and decryption using elliptic curve cryptography.” International Journal of Advance Research In Science And Engineering IJARSE3 (2014).
  3. Singh, Laiphrakpam Dolendro, and Khumanthem Manglem Singh. “Image encryption using elliptic curve cryptography.” Procedia Computer Science54 (2015): 472-481.
  4. Soleymani, Ali, Md Jan Nordin, and Zulkarnain Md Ali. “A Novel Public Key Image Encryption Based on Elliptic Curves over Prime Group Field.” Journal of Image and Graphics1, no. 1 (2013): 43-49.
  5. Nagaraj, Srinivasan, G. S. V. P. Raju, and K. Koteswara Rao. “Image encryption using elliptic curve cryptograhy and matrix.” Procedia Computer Science48 (2015): 276-281.
  6. Shankar, Tarun Narayan, and G. Sahoo. “Cryptography by karatsuba multiplier with ASCII codes.” International journal on computer applications(2010): 53-60.


There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.