# A Novel Machine Learning Technique for Selecting Suitable Image Encryption Algorithms for IoT Applications

Authors: Arslan Shafique; Abid Mehmood; Moatsum Alawida; Abdul Nasir Khan; Atta Ur Rehman Khan
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

The Internet of Things connects billions of intelligent devices that can interact with one another without human intervention, and during communication, a large amount of data is exchanged between the devices. As a result, it is critical to secure digital data using an encryption technique that provides a suitable degree of security. Numerous existing encryption techniques do not offer sufficient security. Therefore, it is critical to figure out which encryption technique is most appropriate for a particular kind of data. When it comes to manually deciding which encryption technique to use, the process might take a long time. In this research, we present a novel technique for selecting Encryption Algorithms (EAs) based on a particular application using pattern recognition and machine learning techniques. To accomplish this goal, we also prepare a dataset. Several machine learning techniques, such as Support Vector Machines (SVMs), Linear Regression (LR),K-Nearest Neighbour (KNN), Naïve Bayes (NB), Decision Trees (DT), and Random Forests (RF), are evaluated. Based on the evaluation, the SVM has been chosen as the best option for the intended technique because its classification accuracy is 98.7%. The experimental results, including accuracy, precision, recall, and F1-score, are used to gauge the performance of the suggested technique. The proposed technique is also compared with the existing techniques to demonstrate its effectiveness.


---

## Body

## 1. Introduction

Nowadays, the Internet of Things IoTs is extensively used in a variety of industries and applications, including manufacturing, agriculture, e-health, home automation, and smart cities. According to Erickson, by 2022, the world will have around 28 billion linked smart devices. Additionally, about 15 billion devices make use of Machine-to-Machine (M2M) connectivity [1]. Additionally, according to a Cisco research, the internet will be connected to about 500 billion devices by 2030 [2]. In this way, it is easy to see why the IoT has attracted the interest of developers, and researchers have given the revolutionary changes it has brought to human existence. The IoT facilitates the sharing of multimedia data across a broad number of applications, including smart transportation, smart health, smart buildings, and industry [3]. As billions of network devices interact and share potentially sensitive data, the most essential concern in the IoT is data security and privacy [4–6]. Figure 1 shows the data transmission between the several linked devices.Figure 1
Data transmission between several connected devices.Different types of Encryption Algorithms (EAs) are developed over the past few decades to secure digital images during transmission between multiple connected devices for IoT applications. One advantage of EAs is their efficiency in terms of computation time. However, insufficient encryption, as evidenced by patterns visible even after encryption, indicates a flaw in the EA [7, 8]. For proper concealment and a sufficient level of encryption of textual data, conventional Data Encryption Standard (DES) and Advanced Encryption Standard (AES) are well-known techniques [9, 10]. There are multiple rounds of encryption involved, making these classic image encryption techniques unsuitable for real-time applications. In the case of image encryption, traditional EAs are not suitable for real-time applications because they contain several encryption rounds. To overcome such issues, several cryptosystems have been proposed in recent years [11–13]. To break the correlation between the image pixels, permutation and substitution are the most widely used techniques to secure digital images [14, 15]. In [16], Shannon proposed a theory that any EA that contains confusion (referring to permutation) and diffusion (referring to substitution or any other process that can change the pixel value) may be considered a strong cryptosystem.Generally, two things must be offered by the EA: (a) strong security (b) and computational efficiency. There will always be a trade-off between security and complexity in terms of time. At times, a strong security algorithm may take longer to execute due to the number of mathematical operations it contains [17]. Time-efficient encryption techniques are always required for real-time applications. Various forms of pixel transformations may be employed in image encryption, including permutation, substitution, the Discrete Wavelet Transform (DWT) [18], the Discrete Cosine Transform (DCT) [19], and the Discrete Fourier Transform (DFT) [20]. All of these approaches have been extensively utilised over the last several decades and proposed a variety of algorithms, some of which are resistant to various types of security attacks, including ciphertext-only attacks, brute force attacks, and plaintext-only attacks. A cryptosystem that is vulnerable to security attacks may have two fundamental problems: (a) it is unable to adequately encrypt the plaintext image due to the identical patterns included within it. Similar patterns also correlate to a high degree of correlation between image pixels; (b) it is computationally inefficient, making it unsuitable for low-profile applications such as data transmission from a drone to a base station, which needs high-speed encryption. On the other side, to propose a time-efficient technique, one may reduce the mathematical operations used in encryption schemes, compromising security and allowing the original image’s patterns to be visible in the encrypted image. The plaintext images with the smooth patterns are shown in Figures 2(a)–2(h). This indicates that there is a significant degree of correlation between the pixels, whereas Figures 2(i)–2(p) depict the corresponding ciphertext images that have been encrypted using various existing encryption schemes [21–24].Figure 2
Plaintext images and their corresponding ciphertext images encrypted with the existing schemes [21, 23–29].
(a)
Plaintext image(b)
Plaintext image(c)
Plaintext image(d)
Plaintext image(e)
Encryption using the scheme proposed in [21](f)
Encryption using the scheme proposed in [25](g)
Encryption using the scheme proposed in [26](h)
Encryption using the scheme proposed in [27](i)
Plaintext image(j)
Plaintext image(k)
Plaintext image(l)
Plaintext image(m)
Encryption using the scheme proposed in [23](n)
Encryption using the scheme proposed in [24](o)
Encryption using the scheme proposed in [28](p)
Encryption using the scheme proposed in [29]The patterns in Figures2(i)–2(l) may be visualized, indicating that such images are encrypted using weak encryption techniques. While Figures 2(m)–2(p) are encrypted using secure encryption techniques, the plaintext image’s patterns have been properly encrypted and are not visible, and the processing time required to encrypt the plaintext image is quite high.For instance, if the image pixels have a low correlation, it is unnecessary to employ the majority of the resources available to encrypt the data included in the image. Generally, an encryption technique that employs a large number of mathematical operations is considered inefficient but extremely secure [28, 30]. Similarly, reducing the number of mathematical operations in an EA makes it more time-efficient, but it may compromise its security level [31]. In the proposed technique, EAs are categorized on the basis of computational complexity. For instance, EAs with processing times of [0.001, 1.00], [1.001, 2.000], and [2.001, ∞] are referred to as low-processing-time encryption (ELPT), moderate-processing-time encryption (EMPT), and high-processing-time encryption (EHPT), respectively.Several metrics such as entropy, correlation, contrast, and energy [32] are evaluated in the suggested study to assess the patterns in the image, whether they are smooth or rough. After evaluating the patterns in the image, the appropriate encryption technique for that specific data may be chosen. The security parameter values may also be determined manually, but it may take a lot of time. As a result, a machine learning-based method is designed to examine the patterns in the plaintext image and suggest a suitable encryption technique, whether the image should be encrypted using a strong EA or concealed using a faster EA. The suggested approach is applicable to images in both colour and grayscale. When a colour image is used, it must be decomposed into three grayscale components, such as red, green, and blue.


### 1.1. Contributions

The major contributions of this work are as follows:(i)
A machine learning model is proposed for pattern recognition-based selection of an appropriate encryption technique(ii)
The security parameters are used to identify the patterns in the plaintext image and set the appropriate intervals for each security parameter to achieve the desired task(iii)
Various machine learning algorithms are evaluated on the proposed work to find the best one(iv)
To improve the overall accuracy of the proposed model,K-fold analysis is performed to develop several models for the proposed work. The developed models are called K-models(v)
Voting mechanisms such as hard and soft voting are used to choose the final model from the severalK-models(vi)
To gauge the performance of the proposed work, several tests and analyses such as accuracy, precision, F1-score, and recall are incorporatedThe rest of the paper is as follows: Section2 is dedicated to a review of the available schemes in the spatial and frequency domains. Section 3 contains preliminaries to the proposed research, including an explanation of SVM and DT. Section 4 discusses the proposed model for selecting an appropriate EA. Section 5 contains an assessment and comparison of the proposed work to previously published work. Finally, Section 6 finishes the proposed work.


## 1.1. Contributions

The major contributions of this work are as follows:(i)
A machine learning model is proposed for pattern recognition-based selection of an appropriate encryption technique(ii)
The security parameters are used to identify the patterns in the plaintext image and set the appropriate intervals for each security parameter to achieve the desired task(iii)
Various machine learning algorithms are evaluated on the proposed work to find the best one(iv)
To improve the overall accuracy of the proposed model,K-fold analysis is performed to develop several models for the proposed work. The developed models are called K-models(v)
Voting mechanisms such as hard and soft voting are used to choose the final model from the severalK-models(vi)
To gauge the performance of the proposed work, several tests and analyses such as accuracy, precision, F1-score, and recall are incorporatedThe rest of the paper is as follows: Section2 is dedicated to a review of the available schemes in the spatial and frequency domains. Section 3 contains preliminaries to the proposed research, including an explanation of SVM and DT. Section 4 discusses the proposed model for selecting an appropriate EA. Section 5 contains an assessment and comparison of the proposed work to previously published work. Finally, Section 6 finishes the proposed work.


## 2. Related Work

For secure communication, data encryption is necessary before transmission. To overcome the security issues, data can be encrypted either in the spatial domain or in the frequency domain. In the spatial domain, one can directly manipulate the pixel values. While in frequency domain encryption, first, pixels convert into their frequency domain and then further process. For instance, if a DWT is applied to the image pixels, it will convert into four different frequency subbands. Once the pixels are converted into their frequency subbands, the mathematical operations can be applied to them for further encryption. EAs can be used according to the applications and patterns existing in the plaintext image. The patterns having high correlation always required strong security EAs, whereas, in drone applications, a fast encryption speed is also required with strong security. Therefore, it is necessary to observe and analyze the patterns present in the image to select the right EA. There are several EAs that have been proposed in the last few decades which are based on either spatial domain or frequency domain.


### 2.1. Image Encryption in Spatial Domain

Spatial domain encryption has advanced significantly since incorporating chaos theory to secure digital images [18]. In the past few decades, chaos has been widely used in image encryption due to its several tremendous properties, such as sensitivity to initial conditions, nonperiodicity, and ability to generate pseudorandom numbers.In [21], Anees et al. proposed an image encryption scheme comprised of two major components. One is a chaotic map, and the second is multiple substitution boxes (S-boxes). Both the components are used to break the high correlation between the image pixels. Moreover, several drawbacks of using a single S-box are addressed. To overcome the vulnerabilities that exist in using a single S-box, multiple S-boxes are used. The S-boxes are selected based on the random sequence generated using the chaotic logistic map. Using statistical analysis, it is proved that the multiple S-box scheme can perform better than the single S-box encryption scheme. However, the patterns of the plaintext image can be visualized. In [33], Ahmad and Hwang made a few improvements to the scheme proposed in [21] by adding noise in the plaintext image prior to the conversion of the noisy image into blocks. To manipulate each block of pixels, a Xor operation is performed that gives the final encrypted image.In the encryption schemes, nonlinear components such as S-boxes also play a vital role in securing digital images. Therefore, it is crucial to use an S-box that exhibits strong cryptographic properties. In [34], Shafique et al. proposed a new methodology to construct an S-box based on a cubic logistic map, which has been given the name C-logo S-box. The purpose of proposing the S-box is to strengthen the overall EA so that the pixels of the plaintext image can be properly concealed. Several tests and analyses, such as Strict Avalanche Criterion (SAC), Bit Independent Criterion (BIC), and nonlinearity, are carried out to show the strength of the proposed S-box. A comparison reveals that the C-logo S-box performs significantly better than the other S-boxes that are present in the literature [35, 36].In [37], Li and Yang introduced an image encryption technique based on chaos and discrete Fractional Wavelet Transforms (FWT). Confusion and diffusion operations are implemented independently, which results in a slight increase in the processing time required for encryption. Additionally, numerous cryptographic components, such as FWT, chaos, and quantum theory, are employed to increase the security of digital images. While using many encryption components sequentially may result in higher security, the processing time required for encryption may increase. Lin et al. [38] proposed a novel method for secure communication based on chaos theory in which mathematical operations to convert the plaintext picture to the ciphertext image are performed sequentially rather than concurrently. Liu et al. [39] proposed a four-dimensional chaotic map-based encryption system with two encryption rounds and one hashing round. Multiple round encryption techniques often perform much better in terms of security but are not suited for real-time applications due to their increased computing time requirements. The encryption presented in [40] encountered computational complexity concerns because of the method’s one-by-one encryption of the HSV components of colour images. Time complexity may be reduced by encrypting the HSV components in parallel. To make the chaos-based encryption scheme more robust, Lidong et al. [41] and Lu et al. [26] used S-box in their proposed cryptosystems. In [41], image compression is also incorporated, followed by encryption to reduce the encryption computational time. Moreover, the scrambling process is applied to the compressed image to break the correlation between the image pixels. To satisfy the criteria of confusion-diffusion proposed by Shannon [16], S-box is applied to create the diffusion in the scrambled image. A single S-box is not enough to secure the image against the deferential attack, specifically, when the image contains smooth patterns. In [26], a new chaotic map called the Logistic-sine System (LSS) is proposed, which has a wider chaotic range. The LSS is then used with the S-box in the proposed encryption scheme, which makes it comparatively more robust than the scheme proposed in [41].


### 2.2. Image Encryption in Frequency Domain

Apart from spatial domain encryption, frequency domain cryptosystems are also frequently used to secure the images from adversaries. Both of these types of encryption are useful to disturb the patterns of the pixels present in the image. Without a specific pattern in the image, it is difficult to read the information. Therefore, it is necessary to disturb the pixel patterns so that no one can read the information present in the image.In [42], Rehman et al. proposed a cryptosystem in which both spatial and frequency domain sections are included. For spatial domain encryption, multiple chaotic maps used are known as chaotic logistic amp and chaotic sine map. These chaotic maps are used to generate random sequences for permutation purposes. Moreover, a chaotic sine map is also used to generate random images for diffusion purposes which are achieved using XOR operation performed on the precipher image with the random image. It is not always required to use a forward operation of any frequency transform such as DWT; one can also use its reverse operation Inverse Discrete Wavelet Transform (IDWT) to secure the digital images [43]. In [18], Shafique et al. proposed a DWT-based cryptosystem in which chaos and bit-plane extraction are the major parts. The whole scheme is consisting of three sections; the first and last sections are dependent on the spatial domain encryption while the middle section is devoted to the frequency domain section. The proposed is designed specially for those images that consist of a large number of the same patterns. As a lot of mathematical operations are included in the proposed scheme, it is somehow slower than the other existing schemes [13, 44–46]. Therefore, the scheme proposed in [18] is not suitable for real-time applications. The image encryption schemes presented in this section are based on chaos theory, bit-plane extraction, frequency transformation, and spatial domain transformation. Some of them can be used for specific purposes. For instance, the scheme proposed in [47] is useful to encrypt the image properly that can resist several security attacks, but it is not suitable for low-profile or real-time applications. Therefore, using the encryption scheme proposed in [47] is not the right choice when anyone wants to encrypt the image faster. Here, it can be noted that the orthodox selection of EA is very important for the particular kind of data. Therefore, a machine learning-based model is proposed to learn the image pattern for the selection of suitable EA.


## 2.1. Image Encryption in Spatial Domain

Spatial domain encryption has advanced significantly since incorporating chaos theory to secure digital images [18]. In the past few decades, chaos has been widely used in image encryption due to its several tremendous properties, such as sensitivity to initial conditions, nonperiodicity, and ability to generate pseudorandom numbers.In [21], Anees et al. proposed an image encryption scheme comprised of two major components. One is a chaotic map, and the second is multiple substitution boxes (S-boxes). Both the components are used to break the high correlation between the image pixels. Moreover, several drawbacks of using a single S-box are addressed. To overcome the vulnerabilities that exist in using a single S-box, multiple S-boxes are used. The S-boxes are selected based on the random sequence generated using the chaotic logistic map. Using statistical analysis, it is proved that the multiple S-box scheme can perform better than the single S-box encryption scheme. However, the patterns of the plaintext image can be visualized. In [33], Ahmad and Hwang made a few improvements to the scheme proposed in [21] by adding noise in the plaintext image prior to the conversion of the noisy image into blocks. To manipulate each block of pixels, a Xor operation is performed that gives the final encrypted image.In the encryption schemes, nonlinear components such as S-boxes also play a vital role in securing digital images. Therefore, it is crucial to use an S-box that exhibits strong cryptographic properties. In [34], Shafique et al. proposed a new methodology to construct an S-box based on a cubic logistic map, which has been given the name C-logo S-box. The purpose of proposing the S-box is to strengthen the overall EA so that the pixels of the plaintext image can be properly concealed. Several tests and analyses, such as Strict Avalanche Criterion (SAC), Bit Independent Criterion (BIC), and nonlinearity, are carried out to show the strength of the proposed S-box. A comparison reveals that the C-logo S-box performs significantly better than the other S-boxes that are present in the literature [35, 36].In [37], Li and Yang introduced an image encryption technique based on chaos and discrete Fractional Wavelet Transforms (FWT). Confusion and diffusion operations are implemented independently, which results in a slight increase in the processing time required for encryption. Additionally, numerous cryptographic components, such as FWT, chaos, and quantum theory, are employed to increase the security of digital images. While using many encryption components sequentially may result in higher security, the processing time required for encryption may increase. Lin et al. [38] proposed a novel method for secure communication based on chaos theory in which mathematical operations to convert the plaintext picture to the ciphertext image are performed sequentially rather than concurrently. Liu et al. [39] proposed a four-dimensional chaotic map-based encryption system with two encryption rounds and one hashing round. Multiple round encryption techniques often perform much better in terms of security but are not suited for real-time applications due to their increased computing time requirements. The encryption presented in [40] encountered computational complexity concerns because of the method’s one-by-one encryption of the HSV components of colour images. Time complexity may be reduced by encrypting the HSV components in parallel. To make the chaos-based encryption scheme more robust, Lidong et al. [41] and Lu et al. [26] used S-box in their proposed cryptosystems. In [41], image compression is also incorporated, followed by encryption to reduce the encryption computational time. Moreover, the scrambling process is applied to the compressed image to break the correlation between the image pixels. To satisfy the criteria of confusion-diffusion proposed by Shannon [16], S-box is applied to create the diffusion in the scrambled image. A single S-box is not enough to secure the image against the deferential attack, specifically, when the image contains smooth patterns. In [26], a new chaotic map called the Logistic-sine System (LSS) is proposed, which has a wider chaotic range. The LSS is then used with the S-box in the proposed encryption scheme, which makes it comparatively more robust than the scheme proposed in [41].


## 2.2. Image Encryption in Frequency Domain

Apart from spatial domain encryption, frequency domain cryptosystems are also frequently used to secure the images from adversaries. Both of these types of encryption are useful to disturb the patterns of the pixels present in the image. Without a specific pattern in the image, it is difficult to read the information. Therefore, it is necessary to disturb the pixel patterns so that no one can read the information present in the image.In [42], Rehman et al. proposed a cryptosystem in which both spatial and frequency domain sections are included. For spatial domain encryption, multiple chaotic maps used are known as chaotic logistic amp and chaotic sine map. These chaotic maps are used to generate random sequences for permutation purposes. Moreover, a chaotic sine map is also used to generate random images for diffusion purposes which are achieved using XOR operation performed on the precipher image with the random image. It is not always required to use a forward operation of any frequency transform such as DWT; one can also use its reverse operation Inverse Discrete Wavelet Transform (IDWT) to secure the digital images [43]. In [18], Shafique et al. proposed a DWT-based cryptosystem in which chaos and bit-plane extraction are the major parts. The whole scheme is consisting of three sections; the first and last sections are dependent on the spatial domain encryption while the middle section is devoted to the frequency domain section. The proposed is designed specially for those images that consist of a large number of the same patterns. As a lot of mathematical operations are included in the proposed scheme, it is somehow slower than the other existing schemes [13, 44–46]. Therefore, the scheme proposed in [18] is not suitable for real-time applications. The image encryption schemes presented in this section are based on chaos theory, bit-plane extraction, frequency transformation, and spatial domain transformation. Some of them can be used for specific purposes. For instance, the scheme proposed in [47] is useful to encrypt the image properly that can resist several security attacks, but it is not suitable for low-profile or real-time applications. Therefore, using the encryption scheme proposed in [47] is not the right choice when anyone wants to encrypt the image faster. Here, it can be noted that the orthodox selection of EA is very important for the particular kind of data. Therefore, a machine learning-based model is proposed to learn the image pattern for the selection of suitable EA.


## 3. Preliminaries

In the proposed work, several machine learning algorithms such as Decision Tree (DT), Support Vector Machine (SVM), Random Forest,K-Nearest Neighbour, and Logistic Regression (LR) are evaluated in which SVM and DT exhibit approximately comparable accuracy and precision. As a result, the preliminary section includes a discussion of SVM and DT. Moreover, among DT and SVM, the final selected ML algorithm is SVM as its accuracy is better than DT and other comparable ML algorithms.


### 3.1. Support Vector Machine

SVM implementation requires training on training data, since it is a supervised learning algorithm that takes training data as an input and predicts the label of the output based on training [48]. The training and testing datasets may or may not vary in size. The whole dataset’s dimension is determined by the number of features employed. For instance, if the dataset has fourteen features, it will be fourteen-dimensional [49]. The general form of the dimension of the dataset is given below:
(1)Y=X1,X2,X3,⋯,Xn,where Y is the dependent output label and Xi represents the number of independent features. The number of features may vary depending upon the output. A line that is a support vector is necessary to separate the data with maximum margins in the two-dimensional dataset. In the case of a higher-dimensional dataset, on the other hand, a plane is utilised to divide the data points rather than a line.The proposed work makes use of an eight-dimensional dataset. As a result, it is required to determine the optimal plane for separating the data points in order to properly classify the unseen sample. The categorization function may be defined as follows:(2)σx=T·X+K,where T and K are the weight vector and the intercept, respectively. However, T can be calculated as
(3)T=xn−xmyn−ym.


### 3.2. Decision Tree

DT is also a supervised learning technique to classify the data into specific classes. The growth of the tree may depend on the number of attributes used in the dataset. For determining the computational cost and classification performance, the heuristic plays a vital role in tree-growing [50]. Mostly, decision trees use an impurity-based heuristic which computes the purity of the resulting subset once the splitting attribute is applied to split the training data [51]. To build the tree for the classification purpose, a root node must be selected, which can be determined by calculating the Information Gain (IG), and the one with the highest IG will be selected as the splitting feature [52]. IG can be calculated as
(4)IGX,Y=EntropyX−∑yXyXEntropyXy,where X represents the training events or feature vectors, Y represents the feature and y represents its value, Xy represents the subset of X containing occurrences with Y=y, and entropy (X) may be determined as follows:
(5)EntropyX−∑j=1BTXbjlogTXbj,where TXbj can be evaluated as the probability of the events belonging to bj in X and B is the number of labels present in the dataset.


## 3.1. Support Vector Machine

SVM implementation requires training on training data, since it is a supervised learning algorithm that takes training data as an input and predicts the label of the output based on training [48]. The training and testing datasets may or may not vary in size. The whole dataset’s dimension is determined by the number of features employed. For instance, if the dataset has fourteen features, it will be fourteen-dimensional [49]. The general form of the dimension of the dataset is given below:
(1)Y=X1,X2,X3,⋯,Xn,where Y is the dependent output label and Xi represents the number of independent features. The number of features may vary depending upon the output. A line that is a support vector is necessary to separate the data with maximum margins in the two-dimensional dataset. In the case of a higher-dimensional dataset, on the other hand, a plane is utilised to divide the data points rather than a line.The proposed work makes use of an eight-dimensional dataset. As a result, it is required to determine the optimal plane for separating the data points in order to properly classify the unseen sample. The categorization function may be defined as follows:(2)σx=T·X+K,where T and K are the weight vector and the intercept, respectively. However, T can be calculated as
(3)T=xn−xmyn−ym.


## 3.2. Decision Tree

DT is also a supervised learning technique to classify the data into specific classes. The growth of the tree may depend on the number of attributes used in the dataset. For determining the computational cost and classification performance, the heuristic plays a vital role in tree-growing [50]. Mostly, decision trees use an impurity-based heuristic which computes the purity of the resulting subset once the splitting attribute is applied to split the training data [51]. To build the tree for the classification purpose, a root node must be selected, which can be determined by calculating the Information Gain (IG), and the one with the highest IG will be selected as the splitting feature [52]. IG can be calculated as
(4)IGX,Y=EntropyX−∑yXyXEntropyXy,where X represents the training events or feature vectors, Y represents the feature and y represents its value, Xy represents the subset of X containing occurrences with Y=y, and entropy (X) may be determined as follows:
(5)EntropyX−∑j=1BTXbjlogTXbj,where TXbj can be evaluated as the probability of the events belonging to bj in X and B is the number of labels present in the dataset.


## 4. Proposed Model

Numerous encryption techniques have been proposed in recent years, including chaos and transformation-based algorithms. Analyzing the statistical results of EAs indicates that some of them are insecure and do not provide enough protection [53–56].In this article, a machine learning model that incorporates SVM is developed to determine the optimal encryption technique for the data in the form of images. The proposed work is shown schematically in Figure3. The process for constructing the proposed model is as follows:
(i)
Take a large collection of plaintext images (I) having size M×N (IijMXN⟶M and N∈ℤ) in which a different amount of information is present. For instance, a few images from the dataset are shown in Figure 4 in which a significant amount of information lies in Figures 4(a)–4(d) as compared to the information present in Figures 4(e)–4(h)Figure 3
Proposed model for the selection of the suitable EA.Figure 4
Information in the plaintext images (a–d) is more than the information in the plaintext images (e–h).
(a)(b)(c)(d)(e)(f)(g)(h)


### 4.1. Features Used in the Proposed Work

Security parameters such as entropy, energy, contrast, correlation, homogeneity, histogram uniformity, and irregular deviation are considered features to select which plaintext image contains the highest, lowest, and moderate amount of information. On the other hand, peak signal to noise ratio and mean square error, both of which are security metrics, need at least two images, such as plaintext and ciphertext, in order to quantify the difference between the two. In our case, only plaintext images are considered in the proposed work.


#### 4.1.1. Entropy

Entropy is used to find the randomness in an image. Furthermore, the entropy value corresponds to the high randomness [57]. The relation between entropy and randomness is given below:
(6)Entropy∝randomness.The maximum entropy value for every image is determined by its bit count. For example, the maximum entropy values for an eight-bit and binary image are 8 and 2, respectively. Entropy may be stated mathematically as(7)Entropy=∑x=1A×Bpswlog2psw,where psw is the probability of occurrence of message sw and A×B represent the number of pixels present in plaintext image.The entropy value of an image increases in proportion to the complexity of the patterns contained inside. As seen in Figures4(a)–4(d), the patterns are visible, indicating that the entropy value for such images is low. Similarly, the entropy values for the images shown in Figures 4(e)–4(h) will be rather high, as indicated in Table 1.Table 1
Values of security parameters corresponding to Figures4(a)–4(h).
ImagesEntropyEnergyCorrelationIDHist2ContrastHomogeneityFigure4(a)7.24160.79860.6798250365299.68988.98960.3367Figure4(b)7.79980.67980.5710256970298.64108.66960.4697Figure4(c)7.17200.67980.3367256971299.64018.97640.6798Figure4(d)7.64770.56780.3665256300300.99638.68790.5556Figure4(e)7.80990.06980.0167240120294.65449.87780.1352Figure4(f)7.70070.05220.0331231687294.33309.98650.1001Figure4(g)7.75560.06980.0130246120294.66609.77890.1336Figure4(h)7.59960.06990.1978246987293.02999.78680.0157To classify the plaintext images to be encrypted either with fast, moderate, or slow processing EA, three intervals are defined in Table2.Table 2
Defined intervals for entropy.
07.99907.900⟶encryptionwithlessprocessingtimeELPT07.29306.449⟶encryptionwithmoderateprocessingtimeEMPT06.42306.001⟶encryptionwithhighprocessingtimeEHPT


#### 4.1.2. Contrast

Contrast analysis of an image allows the observer to identify the objects in the image [57]. Mathematically, it can be calculated as
(8)Contrast=∑c,dc−d2pc,d,where c and d represent the number of rows and columns of the image. Pc,d represents the number of gray levels in the occurrence matrices. The value of contrast reflects that the image contains less information. The relationship between the image pattern and contrast values is given in
(9)Imagepatterns∝Lesscontrastvalue.As demonstrated in Table1, the contrast values for the images in Figures 4(a)–4(d) are smaller than those in Figures 4(e)–4(h). This implies that the images (Figures 4(a)–4(d)) must use a robust encryption scheme to preserve the image’s patterns. Using additional resources to encrypt the images (Figures 4(e)–4(h)) is not a viable option. It may be encrypted using a faster-processing encryption technique with a moderate level of security. The following intervals are given in Table 3 for the categorization of images that may be encrypted using either category of encryption methods.Table 3
Defined intervals for contrast.
10.50009.5000⟶ELPT09.25008.7500⟶EMPT08.50007.5000⟶EHPT


#### 4.1.3. Energy

Energy values reflect the amount of information present in the image. The higher the values of energy, the greater amount of information is present in the image [58]. Energy can be calculated using Equation (10), whereas the relationship between the amount of information and energy is given in Equation (11).
(10)Energy=∑T=1MPc,d,where M shows the total number of pixels in an image (Pc,d):
(11)Information∝Energy.Table1 contains several energy values for various images, and it can be seen that the energy values for the images (Figures 4(a)–4(d)) are higher than the images shown in Figures 4(e)–4(h), implying that the images (Figures 4(a)–4(d)) require strong security algorithms to secure the patterns of the plaintext images. Table 4 shows the intervals for the classification of different EAs.Table 4
Defined intervals for energy.
0.010050.01505⟶ELPT0.015100.02010⟶EMPT0.020150.03495⟶EHPT


#### 4.1.4. Correlation

Correlation indicates the similarity of two or more objects, i.e., correlation between the whole image or a subset of its pixels. Correlation coefficients increase as the object’s similarity increases [59]. In digital images, a gradient pattern has a higher degree of correlation between the pixels than texture patterns, which indicates that images with more gradient patterns will have a higher correlation value, necessitating the use of a powerful encryption technique to break the correlation. In comparison, texture patterns in digital images have less correlation between pixels, which is very simple to eliminate even with a moderate or poor security level encryption techniques. Correlations between image pixels may be calculated using
(12)Corrqp=covq,pTqTp,(13)Covq,p=1M∑r=1Mqr−Gqpr−Gp,(14)Tq=1M∑r=1Mqr−Gq2,(15)Tp=1M∑r=1Mpr−Gp2,(16)Gq=1M∑r=1Mqr,(17)Gp=1M∑r=1Mpr,where q and p denote neighbouring pixel values, respectively, and Corrqp denotes pixel correlation. Correlation coefficients are in the range of −11. Corrqp⟶−1 and Corrqp⟶+1 denoted the correlation between neighbouring pixels’ lowest and maximum values, respectively. The 2500 pixel pairs are taken from the plaintext image in three distinct directions: horizontal, vertical, and diagonal. Figures 5(b)–5(d) and 5(f)–5(h) illustrate the horizontal, vertical, and diagonal correlations of image pixels, respectively. As can be observed, the pixels are closer together, indicating a significant correlation. In comparison, the distribution of pixels in Figures 5(j)–5(l) and 5(n)–5(p) is relatively random, indicating a weaker correlation. Thus, images with a low correlation may be easily secured using a simple, mathematically structured encryption approach. Digital image encryption is classified according to the intervals specified in Table 5.Figure 5
Plaintext images and their corresponding scattered diagrams to show the correlation between the image pixel in horizontal, vertical, and diagonal directions.
(a)
Plain image with high correlation(b)
Horizontal correlation(c)
Vertical correlation(d)
Diagonal correlation(e)
Plain image with high correlation(f)
Horizontal correlation(g)
Vertical correlation(h)
Diagonal correlation(i)
Plain image with comparatively low correlation(j)
Horizontal correlation(k)
Vertical correlation(l)
Diagonal correlation(m)
Plain image with comparatively low correlation(n)
Horizontal correlation(o)
Vertical correlation(p)
Diagonal correlationTable 5
Defined intervals for correlation.
−0.00120.0308⟶ELPT0.00010.0011⟶EMPT0.00000.4500⟶EHPT


#### 4.1.5. Homogeneity

The Grey-level Co-occurrence Matrix (GLCM) illustrates the brightness of pixels. Those images that contain high information have higher homogeneity values. This means that encrypting images with high homogeneity values is difficult and requires a strong encryption scheme. Homogeneity can be calculated as(18)∑x∑yIx,y1+x+y,where Ix,y is plaintext image and x,y shows the pixel position. Table 6 contains the intervals used to classify encryption schemes. If the plaintext image’s homogeneity values fall within the range 0.41220.4418, it may be encrypted using a strategy that requires less mathematical operations and requires less processing time.Table 6
Defined intervals for homogeneity.
0.41220.4418⟶ELPT0.45210.4821⟶EMPT0.53670.6125⟶HLPT


#### 4.1.6. Histogram Analysis

Histogram analysis is often used in image encryption to determine the security of ciphertext images. To offer effective encryption, the encrypting images’ pixel distribution must be constant, which means that the histogram must be flat, which corresponds to the image pixels being properly concealed. Plaintext images contain more information than encrypted images, indicating a less uniform pixel distribution. The histograms of multiple plaintext images are provided in Figure6, along with the pixel distribution.Figure 6
Pixel distribution in original and encrypted images.
(a)(b)(c)(d)(e)(f)(g)(h)The relationship between the information present in the plaintext image and uniformity of the histogram is given as(19)Plaintextinformation∝1Histogramuniformity.According to Equation (19), less uniformity in the histogram indicates that the corresponding image has a greater quantity of information. This implies that images with flat histograms are simple to encrypt and can be made secure by using an encryption strategy with less mathematical operations and processing time. Equation (20) may be used to compute the statistical value of the histogram analysis:
(20)Hist2=∑k=0255gi−tt,where gi represents the number of gray levels and t=M×N/256. According to the existing work [60], Hist2 must be less than 293.24783 to achieve the uniformity in the histogram. Hist2>293.24783 represents the variation in the peaks of the pixels. Based on the Hist2 values, plaintext images are categorized into three intervals as shown in Table 7 for encryption purposes.Table 7
Defined intervals for histogram analysis.
30004000⟶ELPT45006000⟶MLPT65007000⟶HLPT


#### 4.1.7. Irregular Deviation

The uniformity of the histogram also relates to the irregular deviation (ID) in the image pixels. ID may be used to determine image quality. The more information is present in the plaintext images, the higher the ID value. It may be defined as the degree to which the histogram deviation distribution and the uniform distribution are similar. ID can be calculated as
(21)ID=∑j=0255Xi−Xh,where Xi and Xh are the histogram deviations at the ith and h positions, respectively, and the mean value. The less consistent the histograms, the lower the ID value. The ID interval is specified in Table 8 to classify encryption techniques for plaintext images. The summary of the features used in the proposed work is given in Table 9.
(i)
A dataset is created using the security parameters as a feature and the intervals defined in Section4.1. The collection is vast and includes the bulk of textual image categories that we see in everyday life, such as medical images and war images. As a consequence, this dataset is often referred to as the source domain for the proposed model training, validation, and construction. Table 10 includes a subset of the detailed data. The dataset is split into the training and test sets at a ratio of 0.8 : 0.2, as specified in(22)ifTestdatasetTest=N−samplesTrainingdatasetTotalno.ofsamples−N−samples(ii)
After extracting statistical features from plaintext images, save feature values in an array to create unique vector streams (V.S), also referred to as feature vectors. Vector streams may be expressed as follows in terms of their features as given:(23)Dataset=V.S1=f.v1,f.v2,f.v1,⋯,f7V.S2=f.v1,f.v2,f.v1,⋯,f7V.S3=f.v1,f.v2,f.v1,⋯,f7V.S4=f.v1,f.v2,f.v1,⋯,f7⋮V.Sn=f.v1,f.v2,f.v1,⋯,f7.Table 8
Defined intervals forID.
248800247000⟶EHPT250700248900⟶EMPT252600250800⟶ELPTTable 9
Feature summary.
FeaturesMathematical equationsRelationship with strong security (S.S)Variable explanationEnergyEn=∑T=1MPc,dEnergy∝1S.SPa,b is an original imageHistogramHist2=∑k=0255gi−ttt=M×N/256gi: number of gray levelsEntropyEnt=∑x=1A×Bpswlog2pswEnt∝S.Spsw: probability occurrenceA×B: no. of pixelsContrastCont=∑c,dc−d2pc,dCon∝S.Spc,d is gray-level cooccurrence matrixHomogeneityHom=∑x∑yIx,y1+x+yHom∝1S.S—CorrelationCorrqp=covq,p/TqTpCovq,p=1/M∑r=1Mqr−Gqpr−GpTq=1/M∑r=1Mqr−Gq2Tp=1/M∑r=1Mpr−Gp2Gq=1/M∑r=1MqrGp=1/M∑r=1MprCorrelation∝1S.SCorrqp: pixel correlationIrregular deviationID=∑j=0255Xi−XhID∝1S.SXi, Xh: histogram deviationsTable 10
Some portion of the dataset.
F.V no.ImagesEntropyEnergyContrastCorrelationHomogeneityIDHist2EA1Plaintext-180.0110.75-0.50.392247000292.697ELPT2Plaintext-27.99990.0100510.745-0.4950.3921247100292.687ELPT3Plaintext-37.99980.010110.74-0.490.3922247200 0292.996ELPT4Plaintext-47.99970.0101510.735-0.4850.3923247300292.666ELPT5Plaintext-57.99960.010210.73-0.480.3924247400292.697ELPT6Plaintext-67.99950.0102510.725-0.4750.3925247500292.698ELPT7Plaintext-77.99940.010310.72-0.470.3926247600292.341ELPT8Plaintext-387.99930.0103510.715-0.4650.3927247700292.101ELPT9Plaintext-97.99920.010410.71-0.460.3928247800292.198ELPT10Plaintext-107.99910.0104510.705-0.4550.3929247900292.699ELPT11Plaintext-117.9990.010510.7-0.450.393248000292.987ELPT12Plaintext-127.99890.0105510.695-0.4450.3931248100292.310ELPT13Plaintext-137.99880.010610.69-0.440.3932248200292.112ELPT14Plaintext-147.99870.0106510.685-0.4350.3933248300292.874ELPT15Plaintext-157.99860.010710.68-0.430.3934248400292.311ELPT16Plaintext-167.99850.0107510.675-0.4250.3935248500292.336ELPT17Plaintext-177.99840.010810.67-0.420.3936248600292.156ELPT18Plaintext-187.99830.0108510.665-0.4150.3937248700292.667ELPT19Plaintext-197.99820.010910.66-0.410.3938248800292.122ELPT20Plaintext-207.99810.0109510.655-0.4050.3939248800292.966ELPT21Plaintext-217.2930.0150510.2450.00010.4021248900294.334EMPT22Plaintext-227.2920.015110.240.000110.4022249000294.669EMPT23Plaintext-237.2910.0151510.2350.000120.4023249100294.110EMPT24Plaintext-247.2900.015210.230.000130.4024249200294.987EMPT25Plaintext-257.2890.0152510.2250.000140.4025249300294.001EMPT26Plaintext-267.2880.015310.220.000150.4026249400294.312EMPT27Plaintext-277.2870.0153510.2150.000160.4027249500294.900EMPT28Plaintext-287.2860.015410.210.000170.4028249600294.001EMPT29Plaintext-287.2850.0154510.2050.000180.4029249700294.361EMPT30Plaintext-297.2840.015510.20.000190.403249800294.936EMPT31Plaintext-307.2830.0155510.1950.00020.4031249900294.887EMPT32Plaintext-317.2820.015610.190.000210.4032250000294.474EMPT33Plaintext-327.2810.0156510.1850.000220.4033250100294.101EMPT34Plaintext-337.2800.015710.180.000230.4034250200294.031EMPT35Plaintext-347.2790.0157510.1750.000240.4035250300294.351EMPT36Plaintext-357.2780.015810.170.000250.4036250400294.333EMPT37Plaintext-367.2770.0158510.1650.000260.4037250500294.110EMPT38Plaintext-377.2760.015910.160.000270.4038250600294.669EMPT39Plaintext-387.2750.0159510.1550.000280.4039250600294.110EMPT40Plaintext-407.2740.01610.150.000290.404250700294.311EMPT41Plaintext-316.3890.02019.740.00120.4122250800296.003EHPT42Plaintext-426.3880.020159.7350.00130.4123250900297.963EHPT43Plaintext-436.3870.02029.730.00140.4124251000295.221EHPT44Plaintext-446.3860.020259.7250.00150.4125251100298.733EHPT45Plaintext-456.3850.02039.720.00160.4126251200296.331EHPT46Plaintext-466.3840.020359.7150.00170.4127251200297.301EHPT47Plaintext-476.3830.02049.710.00180.4128251300297.332EHPT48Plaintext-486.3820.020459.7050.00190.4129251400297.301EHPT49Plaintext-496.3810.02059.70.0020.413251500296.36EHPT50Plaintext-506.3800.020559.6950.00210.4131251600298.36EHPT51Plaintext-516.3790.02069.690.00220.4132251700297.651EHPT52Plaintext-526.3780.020659.6850.00230.4133251800297.660EHPT53Plaintext-536.3770.02079.680.00240.4134251900297.633EHPT54Plaintext-546.3760.020759.6750.00250.4135252000297.336EHPT55Plaintext-556.3750.02089.670.00260.4136252100297.631EHPT56Plaintext-566.3740.020859.6650.00270.4137252200297.310EHPT57Plaintext-576.3730.02099.660.00280.4138252300296.120EHPT58Plaintext-586.3720.020959.6550.00290.4139252400296.999EHPT59Plaintext-596.3710.0219.650.0030.414252500297.613EHPT60Plaintext-606.3700.021059.6450.00310.4141252600297.643EHPTThe feature values for each feature aref.v1, f.v2, f.v3, ⋯, f.v7. The provided dataset (22) is separated into two sections for the purpose of training the proposed model (training and testing). Each part is further separated into categories, such as X-train and Y-train for training purposes and X-test and Y-test for testing purposes. Train various machine learning algorithms on the training dataset to identify plaintext images based on the information contained in them. The purpose of comparing various machine learning algorithms is to determine which method outperforms the others on the provided dataset. A few instances of categorization for numerous plaintext images are shown in Table 11.Table 11
EA classification based on the information present in the plaintext images.
Plain imagesContrastEntropyEnergyCorrelationHomogeneityIDHist2EAPlain image19.99717.976080.01830.000590.409224763294.664EMPTPlain image28.96517.92830.023340.00610.419224770294.210EMPTPlain image38.41317.86330.024520.00660.4027248706296.331ELPTPlain image410.35747.99370.0159-0.13510.393224993292.665EHPTPlain image511.35857.99820.0151-0.09510.3984247830291.336EHPTPlain image610.98757.993130.1682-0.06510.3994246378292.346EHPTPlain image79.63817.98320.01750.000630.4071249763291.032EHPTPlain image810.89346 7.99310.0145-0.0440.3931248610291.336EHPT


## 4.1. Features Used in the Proposed Work

Security parameters such as entropy, energy, contrast, correlation, homogeneity, histogram uniformity, and irregular deviation are considered features to select which plaintext image contains the highest, lowest, and moderate amount of information. On the other hand, peak signal to noise ratio and mean square error, both of which are security metrics, need at least two images, such as plaintext and ciphertext, in order to quantify the difference between the two. In our case, only plaintext images are considered in the proposed work.


### 4.1.1. Entropy

Entropy is used to find the randomness in an image. Furthermore, the entropy value corresponds to the high randomness [57]. The relation between entropy and randomness is given below:
(6)Entropy∝randomness.The maximum entropy value for every image is determined by its bit count. For example, the maximum entropy values for an eight-bit and binary image are 8 and 2, respectively. Entropy may be stated mathematically as(7)Entropy=∑x=1A×Bpswlog2psw,where psw is the probability of occurrence of message sw and A×B represent the number of pixels present in plaintext image.The entropy value of an image increases in proportion to the complexity of the patterns contained inside. As seen in Figures4(a)–4(d), the patterns are visible, indicating that the entropy value for such images is low. Similarly, the entropy values for the images shown in Figures 4(e)–4(h) will be rather high, as indicated in Table 1.Table 1
Values of security parameters corresponding to Figures4(a)–4(h).
ImagesEntropyEnergyCorrelationIDHist2ContrastHomogeneityFigure4(a)7.24160.79860.6798250365299.68988.98960.3367Figure4(b)7.79980.67980.5710256970298.64108.66960.4697Figure4(c)7.17200.67980.3367256971299.64018.97640.6798Figure4(d)7.64770.56780.3665256300300.99638.68790.5556Figure4(e)7.80990.06980.0167240120294.65449.87780.1352Figure4(f)7.70070.05220.0331231687294.33309.98650.1001Figure4(g)7.75560.06980.0130246120294.66609.77890.1336Figure4(h)7.59960.06990.1978246987293.02999.78680.0157To classify the plaintext images to be encrypted either with fast, moderate, or slow processing EA, three intervals are defined in Table2.Table 2
Defined intervals for entropy.
07.99907.900⟶encryptionwithlessprocessingtimeELPT07.29306.449⟶encryptionwithmoderateprocessingtimeEMPT06.42306.001⟶encryptionwithhighprocessingtimeEHPT


### 4.1.2. Contrast

Contrast analysis of an image allows the observer to identify the objects in the image [57]. Mathematically, it can be calculated as
(8)Contrast=∑c,dc−d2pc,d,where c and d represent the number of rows and columns of the image. Pc,d represents the number of gray levels in the occurrence matrices. The value of contrast reflects that the image contains less information. The relationship between the image pattern and contrast values is given in
(9)Imagepatterns∝Lesscontrastvalue.As demonstrated in Table1, the contrast values for the images in Figures 4(a)–4(d) are smaller than those in Figures 4(e)–4(h). This implies that the images (Figures 4(a)–4(d)) must use a robust encryption scheme to preserve the image’s patterns. Using additional resources to encrypt the images (Figures 4(e)–4(h)) is not a viable option. It may be encrypted using a faster-processing encryption technique with a moderate level of security. The following intervals are given in Table 3 for the categorization of images that may be encrypted using either category of encryption methods.Table 3
Defined intervals for contrast.
10.50009.5000⟶ELPT09.25008.7500⟶EMPT08.50007.5000⟶EHPT


### 4.1.3. Energy

Energy values reflect the amount of information present in the image. The higher the values of energy, the greater amount of information is present in the image [58]. Energy can be calculated using Equation (10), whereas the relationship between the amount of information and energy is given in Equation (11).
(10)Energy=∑T=1MPc,d,where M shows the total number of pixels in an image (Pc,d):
(11)Information∝Energy.Table1 contains several energy values for various images, and it can be seen that the energy values for the images (Figures 4(a)–4(d)) are higher than the images shown in Figures 4(e)–4(h), implying that the images (Figures 4(a)–4(d)) require strong security algorithms to secure the patterns of the plaintext images. Table 4 shows the intervals for the classification of different EAs.Table 4
Defined intervals for energy.
0.010050.01505⟶ELPT0.015100.02010⟶EMPT0.020150.03495⟶EHPT


### 4.1.4. Correlation

Correlation indicates the similarity of two or more objects, i.e., correlation between the whole image or a subset of its pixels. Correlation coefficients increase as the object’s similarity increases [59]. In digital images, a gradient pattern has a higher degree of correlation between the pixels than texture patterns, which indicates that images with more gradient patterns will have a higher correlation value, necessitating the use of a powerful encryption technique to break the correlation. In comparison, texture patterns in digital images have less correlation between pixels, which is very simple to eliminate even with a moderate or poor security level encryption techniques. Correlations between image pixels may be calculated using
(12)Corrqp=covq,pTqTp,(13)Covq,p=1M∑r=1Mqr−Gqpr−Gp,(14)Tq=1M∑r=1Mqr−Gq2,(15)Tp=1M∑r=1Mpr−Gp2,(16)Gq=1M∑r=1Mqr,(17)Gp=1M∑r=1Mpr,where q and p denote neighbouring pixel values, respectively, and Corrqp denotes pixel correlation. Correlation coefficients are in the range of −11. Corrqp⟶−1 and Corrqp⟶+1 denoted the correlation between neighbouring pixels’ lowest and maximum values, respectively. The 2500 pixel pairs are taken from the plaintext image in three distinct directions: horizontal, vertical, and diagonal. Figures 5(b)–5(d) and 5(f)–5(h) illustrate the horizontal, vertical, and diagonal correlations of image pixels, respectively. As can be observed, the pixels are closer together, indicating a significant correlation. In comparison, the distribution of pixels in Figures 5(j)–5(l) and 5(n)–5(p) is relatively random, indicating a weaker correlation. Thus, images with a low correlation may be easily secured using a simple, mathematically structured encryption approach. Digital image encryption is classified according to the intervals specified in Table 5.Figure 5
Plaintext images and their corresponding scattered diagrams to show the correlation between the image pixel in horizontal, vertical, and diagonal directions.
(a)
Plain image with high correlation(b)
Horizontal correlation(c)
Vertical correlation(d)
Diagonal correlation(e)
Plain image with high correlation(f)
Horizontal correlation(g)
Vertical correlation(h)
Diagonal correlation(i)
Plain image with comparatively low correlation(j)
Horizontal correlation(k)
Vertical correlation(l)
Diagonal correlation(m)
Plain image with comparatively low correlation(n)
Horizontal correlation(o)
Vertical correlation(p)
Diagonal correlationTable 5
Defined intervals for correlation.
−0.00120.0308⟶ELPT0.00010.0011⟶EMPT0.00000.4500⟶EHPT


### 4.1.5. Homogeneity

The Grey-level Co-occurrence Matrix (GLCM) illustrates the brightness of pixels. Those images that contain high information have higher homogeneity values. This means that encrypting images with high homogeneity values is difficult and requires a strong encryption scheme. Homogeneity can be calculated as(18)∑x∑yIx,y1+x+y,where Ix,y is plaintext image and x,y shows the pixel position. Table 6 contains the intervals used to classify encryption schemes. If the plaintext image’s homogeneity values fall within the range 0.41220.4418, it may be encrypted using a strategy that requires less mathematical operations and requires less processing time.Table 6
Defined intervals for homogeneity.
0.41220.4418⟶ELPT0.45210.4821⟶EMPT0.53670.6125⟶HLPT


### 4.1.6. Histogram Analysis

Histogram analysis is often used in image encryption to determine the security of ciphertext images. To offer effective encryption, the encrypting images’ pixel distribution must be constant, which means that the histogram must be flat, which corresponds to the image pixels being properly concealed. Plaintext images contain more information than encrypted images, indicating a less uniform pixel distribution. The histograms of multiple plaintext images are provided in Figure6, along with the pixel distribution.Figure 6
Pixel distribution in original and encrypted images.
(a)(b)(c)(d)(e)(f)(g)(h)The relationship between the information present in the plaintext image and uniformity of the histogram is given as(19)Plaintextinformation∝1Histogramuniformity.According to Equation (19), less uniformity in the histogram indicates that the corresponding image has a greater quantity of information. This implies that images with flat histograms are simple to encrypt and can be made secure by using an encryption strategy with less mathematical operations and processing time. Equation (20) may be used to compute the statistical value of the histogram analysis:
(20)Hist2=∑k=0255gi−tt,where gi represents the number of gray levels and t=M×N/256. According to the existing work [60], Hist2 must be less than 293.24783 to achieve the uniformity in the histogram. Hist2>293.24783 represents the variation in the peaks of the pixels. Based on the Hist2 values, plaintext images are categorized into three intervals as shown in Table 7 for encryption purposes.Table 7
Defined intervals for histogram analysis.
30004000⟶ELPT45006000⟶MLPT65007000⟶HLPT


### 4.1.7. Irregular Deviation

The uniformity of the histogram also relates to the irregular deviation (ID) in the image pixels. ID may be used to determine image quality. The more information is present in the plaintext images, the higher the ID value. It may be defined as the degree to which the histogram deviation distribution and the uniform distribution are similar. ID can be calculated as
(21)ID=∑j=0255Xi−Xh,where Xi and Xh are the histogram deviations at the ith and h positions, respectively, and the mean value. The less consistent the histograms, the lower the ID value. The ID interval is specified in Table 8 to classify encryption techniques for plaintext images. The summary of the features used in the proposed work is given in Table 9.
(i)
A dataset is created using the security parameters as a feature and the intervals defined in Section4.1. The collection is vast and includes the bulk of textual image categories that we see in everyday life, such as medical images and war images. As a consequence, this dataset is often referred to as the source domain for the proposed model training, validation, and construction. Table 10 includes a subset of the detailed data. The dataset is split into the training and test sets at a ratio of 0.8 : 0.2, as specified in(22)ifTestdatasetTest=N−samplesTrainingdatasetTotalno.ofsamples−N−samples(ii)
After extracting statistical features from plaintext images, save feature values in an array to create unique vector streams (V.S), also referred to as feature vectors. Vector streams may be expressed as follows in terms of their features as given:(23)Dataset=V.S1=f.v1,f.v2,f.v1,⋯,f7V.S2=f.v1,f.v2,f.v1,⋯,f7V.S3=f.v1,f.v2,f.v1,⋯,f7V.S4=f.v1,f.v2,f.v1,⋯,f7⋮V.Sn=f.v1,f.v2,f.v1,⋯,f7.Table 8
Defined intervals forID.
248800247000⟶EHPT250700248900⟶EMPT252600250800⟶ELPTTable 9
Feature summary.
FeaturesMathematical equationsRelationship with strong security (S.S)Variable explanationEnergyEn=∑T=1MPc,dEnergy∝1S.SPa,b is an original imageHistogramHist2=∑k=0255gi−ttt=M×N/256gi: number of gray levelsEntropyEnt=∑x=1A×Bpswlog2pswEnt∝S.Spsw: probability occurrenceA×B: no. of pixelsContrastCont=∑c,dc−d2pc,dCon∝S.Spc,d is gray-level cooccurrence matrixHomogeneityHom=∑x∑yIx,y1+x+yHom∝1S.S—CorrelationCorrqp=covq,p/TqTpCovq,p=1/M∑r=1Mqr−Gqpr−GpTq=1/M∑r=1Mqr−Gq2Tp=1/M∑r=1Mpr−Gp2Gq=1/M∑r=1MqrGp=1/M∑r=1MprCorrelation∝1S.SCorrqp: pixel correlationIrregular deviationID=∑j=0255Xi−XhID∝1S.SXi, Xh: histogram deviationsTable 10
Some portion of the dataset.
F.V no.ImagesEntropyEnergyContrastCorrelationHomogeneityIDHist2EA1Plaintext-180.0110.75-0.50.392247000292.697ELPT2Plaintext-27.99990.0100510.745-0.4950.3921247100292.687ELPT3Plaintext-37.99980.010110.74-0.490.3922247200 0292.996ELPT4Plaintext-47.99970.0101510.735-0.4850.3923247300292.666ELPT5Plaintext-57.99960.010210.73-0.480.3924247400292.697ELPT6Plaintext-67.99950.0102510.725-0.4750.3925247500292.698ELPT7Plaintext-77.99940.010310.72-0.470.3926247600292.341ELPT8Plaintext-387.99930.0103510.715-0.4650.3927247700292.101ELPT9Plaintext-97.99920.010410.71-0.460.3928247800292.198ELPT10Plaintext-107.99910.0104510.705-0.4550.3929247900292.699ELPT11Plaintext-117.9990.010510.7-0.450.393248000292.987ELPT12Plaintext-127.99890.0105510.695-0.4450.3931248100292.310ELPT13Plaintext-137.99880.010610.69-0.440.3932248200292.112ELPT14Plaintext-147.99870.0106510.685-0.4350.3933248300292.874ELPT15Plaintext-157.99860.010710.68-0.430.3934248400292.311ELPT16Plaintext-167.99850.0107510.675-0.4250.3935248500292.336ELPT17Plaintext-177.99840.010810.67-0.420.3936248600292.156ELPT18Plaintext-187.99830.0108510.665-0.4150.3937248700292.667ELPT19Plaintext-197.99820.010910.66-0.410.3938248800292.122ELPT20Plaintext-207.99810.0109510.655-0.4050.3939248800292.966ELPT21Plaintext-217.2930.0150510.2450.00010.4021248900294.334EMPT22Plaintext-227.2920.015110.240.000110.4022249000294.669EMPT23Plaintext-237.2910.0151510.2350.000120.4023249100294.110EMPT24Plaintext-247.2900.015210.230.000130.4024249200294.987EMPT25Plaintext-257.2890.0152510.2250.000140.4025249300294.001EMPT26Plaintext-267.2880.015310.220.000150.4026249400294.312EMPT27Plaintext-277.2870.0153510.2150.000160.4027249500294.900EMPT28Plaintext-287.2860.015410.210.000170.4028249600294.001EMPT29Plaintext-287.2850.0154510.2050.000180.4029249700294.361EMPT30Plaintext-297.2840.015510.20.000190.403249800294.936EMPT31Plaintext-307.2830.0155510.1950.00020.4031249900294.887EMPT32Plaintext-317.2820.015610.190.000210.4032250000294.474EMPT33Plaintext-327.2810.0156510.1850.000220.4033250100294.101EMPT34Plaintext-337.2800.015710.180.000230.4034250200294.031EMPT35Plaintext-347.2790.0157510.1750.000240.4035250300294.351EMPT36Plaintext-357.2780.015810.170.000250.4036250400294.333EMPT37Plaintext-367.2770.0158510.1650.000260.4037250500294.110EMPT38Plaintext-377.2760.015910.160.000270.4038250600294.669EMPT39Plaintext-387.2750.0159510.1550.000280.4039250600294.110EMPT40Plaintext-407.2740.01610.150.000290.404250700294.311EMPT41Plaintext-316.3890.02019.740.00120.4122250800296.003EHPT42Plaintext-426.3880.020159.7350.00130.4123250900297.963EHPT43Plaintext-436.3870.02029.730.00140.4124251000295.221EHPT44Plaintext-446.3860.020259.7250.00150.4125251100298.733EHPT45Plaintext-456.3850.02039.720.00160.4126251200296.331EHPT46Plaintext-466.3840.020359.7150.00170.4127251200297.301EHPT47Plaintext-476.3830.02049.710.00180.4128251300297.332EHPT48Plaintext-486.3820.020459.7050.00190.4129251400297.301EHPT49Plaintext-496.3810.02059.70.0020.413251500296.36EHPT50Plaintext-506.3800.020559.6950.00210.4131251600298.36EHPT51Plaintext-516.3790.02069.690.00220.4132251700297.651EHPT52Plaintext-526.3780.020659.6850.00230.4133251800297.660EHPT53Plaintext-536.3770.02079.680.00240.4134251900297.633EHPT54Plaintext-546.3760.020759.6750.00250.4135252000297.336EHPT55Plaintext-556.3750.02089.670.00260.4136252100297.631EHPT56Plaintext-566.3740.020859.6650.00270.4137252200297.310EHPT57Plaintext-576.3730.02099.660.00280.4138252300296.120EHPT58Plaintext-586.3720.020959.6550.00290.4139252400296.999EHPT59Plaintext-596.3710.0219.650.0030.414252500297.613EHPT60Plaintext-606.3700.021059.6450.00310.4141252600297.643EHPTThe feature values for each feature aref.v1, f.v2, f.v3, ⋯, f.v7. The provided dataset (22) is separated into two sections for the purpose of training the proposed model (training and testing). Each part is further separated into categories, such as X-train and Y-train for training purposes and X-test and Y-test for testing purposes. Train various machine learning algorithms on the training dataset to identify plaintext images based on the information contained in them. The purpose of comparing various machine learning algorithms is to determine which method outperforms the others on the provided dataset. A few instances of categorization for numerous plaintext images are shown in Table 11.Table 11
EA classification based on the information present in the plaintext images.
Plain imagesContrastEntropyEnergyCorrelationHomogeneityIDHist2EAPlain image19.99717.976080.01830.000590.409224763294.664EMPTPlain image28.96517.92830.023340.00610.419224770294.210EMPTPlain image38.41317.86330.024520.00660.4027248706296.331ELPTPlain image410.35747.99370.0159-0.13510.393224993292.665EHPTPlain image511.35857.99820.0151-0.09510.3984247830291.336EHPTPlain image610.98757.993130.1682-0.06510.3994246378292.346EHPTPlain image79.63817.98320.01750.000630.4071249763291.032EHPTPlain image810.89346 7.99310.0145-0.0440.3931248610291.336EHPT


## 4.1.1. Entropy

Entropy is used to find the randomness in an image. Furthermore, the entropy value corresponds to the high randomness [57]. The relation between entropy and randomness is given below:
(6)Entropy∝randomness.The maximum entropy value for every image is determined by its bit count. For example, the maximum entropy values for an eight-bit and binary image are 8 and 2, respectively. Entropy may be stated mathematically as(7)Entropy=∑x=1A×Bpswlog2psw,where psw is the probability of occurrence of message sw and A×B represent the number of pixels present in plaintext image.The entropy value of an image increases in proportion to the complexity of the patterns contained inside. As seen in Figures4(a)–4(d), the patterns are visible, indicating that the entropy value for such images is low. Similarly, the entropy values for the images shown in Figures 4(e)–4(h) will be rather high, as indicated in Table 1.Table 1
Values of security parameters corresponding to Figures4(a)–4(h).
ImagesEntropyEnergyCorrelationIDHist2ContrastHomogeneityFigure4(a)7.24160.79860.6798250365299.68988.98960.3367Figure4(b)7.79980.67980.5710256970298.64108.66960.4697Figure4(c)7.17200.67980.3367256971299.64018.97640.6798Figure4(d)7.64770.56780.3665256300300.99638.68790.5556Figure4(e)7.80990.06980.0167240120294.65449.87780.1352Figure4(f)7.70070.05220.0331231687294.33309.98650.1001Figure4(g)7.75560.06980.0130246120294.66609.77890.1336Figure4(h)7.59960.06990.1978246987293.02999.78680.0157To classify the plaintext images to be encrypted either with fast, moderate, or slow processing EA, three intervals are defined in Table2.Table 2
Defined intervals for entropy.
07.99907.900⟶encryptionwithlessprocessingtimeELPT07.29306.449⟶encryptionwithmoderateprocessingtimeEMPT06.42306.001⟶encryptionwithhighprocessingtimeEHPT


## 4.1.2. Contrast

Contrast analysis of an image allows the observer to identify the objects in the image [57]. Mathematically, it can be calculated as
(8)Contrast=∑c,dc−d2pc,d,where c and d represent the number of rows and columns of the image. Pc,d represents the number of gray levels in the occurrence matrices. The value of contrast reflects that the image contains less information. The relationship between the image pattern and contrast values is given in
(9)Imagepatterns∝Lesscontrastvalue.As demonstrated in Table1, the contrast values for the images in Figures 4(a)–4(d) are smaller than those in Figures 4(e)–4(h). This implies that the images (Figures 4(a)–4(d)) must use a robust encryption scheme to preserve the image’s patterns. Using additional resources to encrypt the images (Figures 4(e)–4(h)) is not a viable option. It may be encrypted using a faster-processing encryption technique with a moderate level of security. The following intervals are given in Table 3 for the categorization of images that may be encrypted using either category of encryption methods.Table 3
Defined intervals for contrast.
10.50009.5000⟶ELPT09.25008.7500⟶EMPT08.50007.5000⟶EHPT


## 4.1.3. Energy

Energy values reflect the amount of information present in the image. The higher the values of energy, the greater amount of information is present in the image [58]. Energy can be calculated using Equation (10), whereas the relationship between the amount of information and energy is given in Equation (11).
(10)Energy=∑T=1MPc,d,where M shows the total number of pixels in an image (Pc,d):
(11)Information∝Energy.Table1 contains several energy values for various images, and it can be seen that the energy values for the images (Figures 4(a)–4(d)) are higher than the images shown in Figures 4(e)–4(h), implying that the images (Figures 4(a)–4(d)) require strong security algorithms to secure the patterns of the plaintext images. Table 4 shows the intervals for the classification of different EAs.Table 4
Defined intervals for energy.
0.010050.01505⟶ELPT0.015100.02010⟶EMPT0.020150.03495⟶EHPT


## 4.1.4. Correlation

Correlation indicates the similarity of two or more objects, i.e., correlation between the whole image or a subset of its pixels. Correlation coefficients increase as the object’s similarity increases [59]. In digital images, a gradient pattern has a higher degree of correlation between the pixels than texture patterns, which indicates that images with more gradient patterns will have a higher correlation value, necessitating the use of a powerful encryption technique to break the correlation. In comparison, texture patterns in digital images have less correlation between pixels, which is very simple to eliminate even with a moderate or poor security level encryption techniques. Correlations between image pixels may be calculated using
(12)Corrqp=covq,pTqTp,(13)Covq,p=1M∑r=1Mqr−Gqpr−Gp,(14)Tq=1M∑r=1Mqr−Gq2,(15)Tp=1M∑r=1Mpr−Gp2,(16)Gq=1M∑r=1Mqr,(17)Gp=1M∑r=1Mpr,where q and p denote neighbouring pixel values, respectively, and Corrqp denotes pixel correlation. Correlation coefficients are in the range of −11. Corrqp⟶−1 and Corrqp⟶+1 denoted the correlation between neighbouring pixels’ lowest and maximum values, respectively. The 2500 pixel pairs are taken from the plaintext image in three distinct directions: horizontal, vertical, and diagonal. Figures 5(b)–5(d) and 5(f)–5(h) illustrate the horizontal, vertical, and diagonal correlations of image pixels, respectively. As can be observed, the pixels are closer together, indicating a significant correlation. In comparison, the distribution of pixels in Figures 5(j)–5(l) and 5(n)–5(p) is relatively random, indicating a weaker correlation. Thus, images with a low correlation may be easily secured using a simple, mathematically structured encryption approach. Digital image encryption is classified according to the intervals specified in Table 5.Figure 5
Plaintext images and their corresponding scattered diagrams to show the correlation between the image pixel in horizontal, vertical, and diagonal directions.
(a)
Plain image with high correlation(b)
Horizontal correlation(c)
Vertical correlation(d)
Diagonal correlation(e)
Plain image with high correlation(f)
Horizontal correlation(g)
Vertical correlation(h)
Diagonal correlation(i)
Plain image with comparatively low correlation(j)
Horizontal correlation(k)
Vertical correlation(l)
Diagonal correlation(m)
Plain image with comparatively low correlation(n)
Horizontal correlation(o)
Vertical correlation(p)
Diagonal correlationTable 5
Defined intervals for correlation.
−0.00120.0308⟶ELPT0.00010.0011⟶EMPT0.00000.4500⟶EHPT


## 4.1.5. Homogeneity

The Grey-level Co-occurrence Matrix (GLCM) illustrates the brightness of pixels. Those images that contain high information have higher homogeneity values. This means that encrypting images with high homogeneity values is difficult and requires a strong encryption scheme. Homogeneity can be calculated as(18)∑x∑yIx,y1+x+y,where Ix,y is plaintext image and x,y shows the pixel position. Table 6 contains the intervals used to classify encryption schemes. If the plaintext image’s homogeneity values fall within the range 0.41220.4418, it may be encrypted using a strategy that requires less mathematical operations and requires less processing time.Table 6
Defined intervals for homogeneity.
0.41220.4418⟶ELPT0.45210.4821⟶EMPT0.53670.6125⟶HLPT


## 4.1.6. Histogram Analysis

Histogram analysis is often used in image encryption to determine the security of ciphertext images. To offer effective encryption, the encrypting images’ pixel distribution must be constant, which means that the histogram must be flat, which corresponds to the image pixels being properly concealed. Plaintext images contain more information than encrypted images, indicating a less uniform pixel distribution. The histograms of multiple plaintext images are provided in Figure6, along with the pixel distribution.Figure 6
Pixel distribution in original and encrypted images.
(a)(b)(c)(d)(e)(f)(g)(h)The relationship between the information present in the plaintext image and uniformity of the histogram is given as(19)Plaintextinformation∝1Histogramuniformity.According to Equation (19), less uniformity in the histogram indicates that the corresponding image has a greater quantity of information. This implies that images with flat histograms are simple to encrypt and can be made secure by using an encryption strategy with less mathematical operations and processing time. Equation (20) may be used to compute the statistical value of the histogram analysis:
(20)Hist2=∑k=0255gi−tt,where gi represents the number of gray levels and t=M×N/256. According to the existing work [60], Hist2 must be less than 293.24783 to achieve the uniformity in the histogram. Hist2>293.24783 represents the variation in the peaks of the pixels. Based on the Hist2 values, plaintext images are categorized into three intervals as shown in Table 7 for encryption purposes.Table 7
Defined intervals for histogram analysis.
30004000⟶ELPT45006000⟶MLPT65007000⟶HLPT


## 4.1.7. Irregular Deviation

The uniformity of the histogram also relates to the irregular deviation (ID) in the image pixels. ID may be used to determine image quality. The more information is present in the plaintext images, the higher the ID value. It may be defined as the degree to which the histogram deviation distribution and the uniform distribution are similar. ID can be calculated as
(21)ID=∑j=0255Xi−Xh,where Xi and Xh are the histogram deviations at the ith and h positions, respectively, and the mean value. The less consistent the histograms, the lower the ID value. The ID interval is specified in Table 8 to classify encryption techniques for plaintext images. The summary of the features used in the proposed work is given in Table 9.
(i)
A dataset is created using the security parameters as a feature and the intervals defined in Section4.1. The collection is vast and includes the bulk of textual image categories that we see in everyday life, such as medical images and war images. As a consequence, this dataset is often referred to as the source domain for the proposed model training, validation, and construction. Table 10 includes a subset of the detailed data. The dataset is split into the training and test sets at a ratio of 0.8 : 0.2, as specified in(22)ifTestdatasetTest=N−samplesTrainingdatasetTotalno.ofsamples−N−samples(ii)
After extracting statistical features from plaintext images, save feature values in an array to create unique vector streams (V.S), also referred to as feature vectors. Vector streams may be expressed as follows in terms of their features as given:(23)Dataset=V.S1=f.v1,f.v2,f.v1,⋯,f7V.S2=f.v1,f.v2,f.v1,⋯,f7V.S3=f.v1,f.v2,f.v1,⋯,f7V.S4=f.v1,f.v2,f.v1,⋯,f7⋮V.Sn=f.v1,f.v2,f.v1,⋯,f7.Table 8
Defined intervals forID.
248800247000⟶EHPT250700248900⟶EMPT252600250800⟶ELPTTable 9
Feature summary.
FeaturesMathematical equationsRelationship with strong security (S.S)Variable explanationEnergyEn=∑T=1MPc,dEnergy∝1S.SPa,b is an original imageHistogramHist2=∑k=0255gi−ttt=M×N/256gi: number of gray levelsEntropyEnt=∑x=1A×Bpswlog2pswEnt∝S.Spsw: probability occurrenceA×B: no. of pixelsContrastCont=∑c,dc−d2pc,dCon∝S.Spc,d is gray-level cooccurrence matrixHomogeneityHom=∑x∑yIx,y1+x+yHom∝1S.S—CorrelationCorrqp=covq,p/TqTpCovq,p=1/M∑r=1Mqr−Gqpr−GpTq=1/M∑r=1Mqr−Gq2Tp=1/M∑r=1Mpr−Gp2Gq=1/M∑r=1MqrGp=1/M∑r=1MprCorrelation∝1S.SCorrqp: pixel correlationIrregular deviationID=∑j=0255Xi−XhID∝1S.SXi, Xh: histogram deviationsTable 10
Some portion of the dataset.
F.V no.ImagesEntropyEnergyContrastCorrelationHomogeneityIDHist2EA1Plaintext-180.0110.75-0.50.392247000292.697ELPT2Plaintext-27.99990.0100510.745-0.4950.3921247100292.687ELPT3Plaintext-37.99980.010110.74-0.490.3922247200 0292.996ELPT4Plaintext-47.99970.0101510.735-0.4850.3923247300292.666ELPT5Plaintext-57.99960.010210.73-0.480.3924247400292.697ELPT6Plaintext-67.99950.0102510.725-0.4750.3925247500292.698ELPT7Plaintext-77.99940.010310.72-0.470.3926247600292.341ELPT8Plaintext-387.99930.0103510.715-0.4650.3927247700292.101ELPT9Plaintext-97.99920.010410.71-0.460.3928247800292.198ELPT10Plaintext-107.99910.0104510.705-0.4550.3929247900292.699ELPT11Plaintext-117.9990.010510.7-0.450.393248000292.987ELPT12Plaintext-127.99890.0105510.695-0.4450.3931248100292.310ELPT13Plaintext-137.99880.010610.69-0.440.3932248200292.112ELPT14Plaintext-147.99870.0106510.685-0.4350.3933248300292.874ELPT15Plaintext-157.99860.010710.68-0.430.3934248400292.311ELPT16Plaintext-167.99850.0107510.675-0.4250.3935248500292.336ELPT17Plaintext-177.99840.010810.67-0.420.3936248600292.156ELPT18Plaintext-187.99830.0108510.665-0.4150.3937248700292.667ELPT19Plaintext-197.99820.010910.66-0.410.3938248800292.122ELPT20Plaintext-207.99810.0109510.655-0.4050.3939248800292.966ELPT21Plaintext-217.2930.0150510.2450.00010.4021248900294.334EMPT22Plaintext-227.2920.015110.240.000110.4022249000294.669EMPT23Plaintext-237.2910.0151510.2350.000120.4023249100294.110EMPT24Plaintext-247.2900.015210.230.000130.4024249200294.987EMPT25Plaintext-257.2890.0152510.2250.000140.4025249300294.001EMPT26Plaintext-267.2880.015310.220.000150.4026249400294.312EMPT27Plaintext-277.2870.0153510.2150.000160.4027249500294.900EMPT28Plaintext-287.2860.015410.210.000170.4028249600294.001EMPT29Plaintext-287.2850.0154510.2050.000180.4029249700294.361EMPT30Plaintext-297.2840.015510.20.000190.403249800294.936EMPT31Plaintext-307.2830.0155510.1950.00020.4031249900294.887EMPT32Plaintext-317.2820.015610.190.000210.4032250000294.474EMPT33Plaintext-327.2810.0156510.1850.000220.4033250100294.101EMPT34Plaintext-337.2800.015710.180.000230.4034250200294.031EMPT35Plaintext-347.2790.0157510.1750.000240.4035250300294.351EMPT36Plaintext-357.2780.015810.170.000250.4036250400294.333EMPT37Plaintext-367.2770.0158510.1650.000260.4037250500294.110EMPT38Plaintext-377.2760.015910.160.000270.4038250600294.669EMPT39Plaintext-387.2750.0159510.1550.000280.4039250600294.110EMPT40Plaintext-407.2740.01610.150.000290.404250700294.311EMPT41Plaintext-316.3890.02019.740.00120.4122250800296.003EHPT42Plaintext-426.3880.020159.7350.00130.4123250900297.963EHPT43Plaintext-436.3870.02029.730.00140.4124251000295.221EHPT44Plaintext-446.3860.020259.7250.00150.4125251100298.733EHPT45Plaintext-456.3850.02039.720.00160.4126251200296.331EHPT46Plaintext-466.3840.020359.7150.00170.4127251200297.301EHPT47Plaintext-476.3830.02049.710.00180.4128251300297.332EHPT48Plaintext-486.3820.020459.7050.00190.4129251400297.301EHPT49Plaintext-496.3810.02059.70.0020.413251500296.36EHPT50Plaintext-506.3800.020559.6950.00210.4131251600298.36EHPT51Plaintext-516.3790.02069.690.00220.4132251700297.651EHPT52Plaintext-526.3780.020659.6850.00230.4133251800297.660EHPT53Plaintext-536.3770.02079.680.00240.4134251900297.633EHPT54Plaintext-546.3760.020759.6750.00250.4135252000297.336EHPT55Plaintext-556.3750.02089.670.00260.4136252100297.631EHPT56Plaintext-566.3740.020859.6650.00270.4137252200297.310EHPT57Plaintext-576.3730.02099.660.00280.4138252300296.120EHPT58Plaintext-586.3720.020959.6550.00290.4139252400296.999EHPT59Plaintext-596.3710.0219.650.0030.414252500297.613EHPT60Plaintext-606.3700.021059.6450.00310.4141252600297.643EHPTThe feature values for each feature aref.v1, f.v2, f.v3, ⋯, f.v7. The provided dataset (22) is separated into two sections for the purpose of training the proposed model (training and testing). Each part is further separated into categories, such as X-train and Y-train for training purposes and X-test and Y-test for testing purposes. Train various machine learning algorithms on the training dataset to identify plaintext images based on the information contained in them. The purpose of comparing various machine learning algorithms is to determine which method outperforms the others on the provided dataset. A few instances of categorization for numerous plaintext images are shown in Table 11.Table 11
EA classification based on the information present in the plaintext images.
Plain imagesContrastEntropyEnergyCorrelationHomogeneityIDHist2EAPlain image19.99717.976080.01830.000590.409224763294.664EMPTPlain image28.96517.92830.023340.00610.419224770294.210EMPTPlain image38.41317.86330.024520.00660.4027248706296.331ELPTPlain image410.35747.99370.0159-0.13510.393224993292.665EHPTPlain image511.35857.99820.0151-0.09510.3984247830291.336EHPTPlain image610.98757.993130.1682-0.06510.3994246378292.346EHPTPlain image79.63817.98320.01750.000630.4071249763291.032EHPTPlain image810.89346 7.99310.0145-0.0440.3931248610291.336EHPT


## 5. Results and Discussion

Two distinct tools such as MATLAB 2014a and a Jupyter notebook (for Python, version 3.7) are used to construct the proposed model. Several characteristics including accuracy, precision, recall, andF-score are examined while evaluating the proposed model, and their values may be simply computed using the confusion matrix. This is a two-dimensional array that contains True Positive (TP), True Negative (TN), False Positive (FP), and False Negatives (FN). Figure 7 shows the generalised confusion matrix and the confusion matrices for the proposed work when DT, K-NN, RF, NB, and SVM are used.Figure 7
Confusion matrices for CNN, transfer learning, and fine tuning based on the proposed model.
(a)
Confusion matrix(b)
Confusion matrix for when SVM is incorporated(c)
Confusion matrix for when K-NN is incorporated(d)
Confusion matrix for when DT is incorporated(e)
Confusion matrix for when NB is incorporated(f)
Confusion matrix for when LR is incorporatedThe termsTP, TN, FP, and FN are defined below according to the proposed model.
(i)
True positives (TP)The proposed technique predicts that a strong EA (EHPT) is required to encrypt such a plaintext image that contains a bulk of information.(ii)
True negatives (TN)The proposed technique predicts that such an EA is required that offers moderate security (EMPT) to encrypt a plaintext image that contains moderate amount of information, or the proposed technique predicts that such an EA is required that offers weak security (ELPT) to encrypt a plaintext image which contains less amount of information.(iii)
False positives(FP)The proposed technique predicts that a strong EA (EHPT) is required to encrypt such a plaintext image that contains moderate or less amount of information.(iv)
False negatives (FN)The proposed technique predicts that such an EA is required that offers moderate security (EMPT) to encrypt a plaintext image that contains a bulk of information, or the proposed technique predicts that such an EA is required that offers weak security (ELPT) to encrypt a plaintext image that contains a moderate amount of information.The mathematical equations and corresponding values calculated using the proposed mode are shown in Table12.Table 12
Performance measuring parameters and their statistical values.
ParametersMathematical equationsAccuracy (Accy)ΓP+ΓN1+ΓN2ΓP+ΓN1+ΓN2+⊑N1+⊑N2+⊑P1+⊑N3++⊑P2+⊑N42250+1190+14952250+20+15+5+1190+13+8+4+1495×100=98.7%Specificity (Specy)/precision (Precy)ΓPΓP+⊑N1+⊑N2+⊑N3+⊑N422502250+20+15+13+4=0.97Sensitivity (Seny)/recallΓN1+ΓN2ΓN1+ΓN2+⊑P1+⊑P21190+14951190+1495+5+8=0.99F1-score2×Seny×SpecySeny+Specy=0.97To enhance the overall accuracy of the proposed model,K-fold analysis is performed in which five different values of K (K=5,K=10,K=20,K=25,andK=50) are selected to build five models (M1, M2, M3, M4, and M5). For instance, if K=20, a total of twenty iterations will be performed and take the average accuracy for M1. The mathematical representation for calculating the average accuracy for M3 (Avgacc) is shown in Equations (24) and (25), whereas Avgacc for other classifiers at different values of K are displayed in Table 13:
(24)AvgaccM3=AccK1+AccK2+AccK3+AccK4+AccK55×100,(25)AccuracyM1=98.8+98.7+98.9+98.9+98.85=98.8%.Table 13
K-fold analysis for accuracy.
ClassifiersSVMNBLRK-NNDTK=5M198.591.693.993.893.8K=10M298.690.592.294.292.3K=20M398.892.392.793.992.9K=25M498.791.693.393.493.8K=50M598.492.893.194.793.6Finally, voting techniques such as soft and hard voting are applied on the proposedM-models to classify the labels in a more sophisticated way.


### 5.1. Hard Voting

This technique works on the majority of votes. For instance, there are five models for the proposed work (M1,M−2,⋯,M5). Three of them classify the upcoming event as ELPT, one each is for classes EMPT and EHPT. Therefore, according to the hard voting technique, the new event will belong to class ELPT as shown in Figure 8.Figure 8
Hard voting-based classification


### 5.2. Soft Voting

The probability-based classification can be performed using soft voting. In this technique, the probability of each class occurring is calculated separately, and then, the decision will be in favour of the class which has the highest probability value, as shown in Figure9.Figure 9
Hard voting-based classificationThe probability of occurring in each class (ELPT, EMPT, and EHPT) using the generatedM-models is calculated individually according to
(26)ForclassELPT=PoELPT1+PoELPT2+PoELPT3+⋯+PoELPTNN,(27)ForclassEMPT=PoEMPT1+PoEMPT2+PoEMPT3+⋯+PoEMPTNN,(28)ForclassEHPT=PoEHPT1+PoEHPT2+PoEHPT3+⋯+PoEHPTNN,where PoELPT, PoEMPT, and PoEHPT is the probability of occurring in the events ELPT, EMPT, and EHPT, respectively. According to the calculated probabilities, Equations (29), (30), and (31) become
(29)ForclassELPT=60+70+10+30+405×100=42%,(30)ForclassEMPT=30+15+40+20+505×100=31%,(31)ForclassEHPT=10+15+50+50+105×100=27%.According to Equations (29), (30), and (31), the upcoming event will belong to class ELPT.The statistical values of the performance metrics for the proposed and existing work are displayed in Table14. Several machine learning algorithms, including SVM, NB, LR, DT, RF, and K-NN, are evaluated when comparing the proposed work to current models. Based on the comparative study, it is evident that, among the machine learning algorithms used in the proposed work, SVM offers the highest accuracy. Moreover, comparable schemes are significantly less accurate than the proposed approach. However, the technique suggested in [61] has a 95% accuracy rate, which is comparable to the accuracy offered by the proposed work.Table 14
Performance comparison with existing models.
SchemesSVM (sigmoid kernel)SVM (linear kernel)SVM (rbf kernel)SVM(polynomial kernel)NBLRDTRFK-NNAccuracy (Accy)Proposed98.795.496.395.890.278.380.695.296.9Reference [62]918189909092918486Reference [63]869392929192929192Reference [61]957577797374828486Reference [64]858382899293919297Reference [65]928682929294919293Precision (Precy)Proposed0.970.980.980.890.990.320.350.990.97Reference [62]0.840.920.900.850.860.870.890.920.89Reference [63]0.920.950.930.960.930.930.950.980.99Reference [61]0.890.880.870.840.92.970.980.970.98Reference [64]0.970.950.960.980.960990.980.990.98Reference [65]0.890.880.870.840.92.970.980.970.98Sensitivity (Seny)Proposed0.970.980.990.960.800.150.870.920.85Reference [62]0.890.920.930.950.910.940.950.940.92Reference [63]0.920.940.910.900.980.940.950.920.91Reference [61]0.970.910.920.910.920.960.950.920.96Reference [64]0.910.920.900.890.960.920.930.910.92Reference [65]0.910.920.940.960.960.920.920.910.91F1-scoreProposed0.980.990.980.960.890.220.450.9491Reference [62]0.860.920.810.880.850.970.930.940.92Reference [63]0.920.920.830.920.930.910.980.960.94Reference [61]0.910.900.920.930.920.910.950.960.99Reference [64]0.960.970.920.910.910.960.950.920.91Reference [65]0.910.900.920.930.920.910.950.960.99


## 5.1. Hard Voting

This technique works on the majority of votes. For instance, there are five models for the proposed work (M1,M−2,⋯,M5). Three of them classify the upcoming event as ELPT, one each is for classes EMPT and EHPT. Therefore, according to the hard voting technique, the new event will belong to class ELPT as shown in Figure 8.Figure 8
Hard voting-based classification


## 5.2. Soft Voting

The probability-based classification can be performed using soft voting. In this technique, the probability of each class occurring is calculated separately, and then, the decision will be in favour of the class which has the highest probability value, as shown in Figure9.Figure 9
Hard voting-based classificationThe probability of occurring in each class (ELPT, EMPT, and EHPT) using the generatedM-models is calculated individually according to
(26)ForclassELPT=PoELPT1+PoELPT2+PoELPT3+⋯+PoELPTNN,(27)ForclassEMPT=PoEMPT1+PoEMPT2+PoEMPT3+⋯+PoEMPTNN,(28)ForclassEHPT=PoEHPT1+PoEHPT2+PoEHPT3+⋯+PoEHPTNN,where PoELPT, PoEMPT, and PoEHPT is the probability of occurring in the events ELPT, EMPT, and EHPT, respectively. According to the calculated probabilities, Equations (29), (30), and (31) become
(29)ForclassELPT=60+70+10+30+405×100=42%,(30)ForclassEMPT=30+15+40+20+505×100=31%,(31)ForclassEHPT=10+15+50+50+105×100=27%.According to Equations (29), (30), and (31), the upcoming event will belong to class ELPT.The statistical values of the performance metrics for the proposed and existing work are displayed in Table14. Several machine learning algorithms, including SVM, NB, LR, DT, RF, and K-NN, are evaluated when comparing the proposed work to current models. Based on the comparative study, it is evident that, among the machine learning algorithms used in the proposed work, SVM offers the highest accuracy. Moreover, comparable schemes are significantly less accurate than the proposed approach. However, the technique suggested in [61] has a 95% accuracy rate, which is comparable to the accuracy offered by the proposed work.Table 14
Performance comparison with existing models.
SchemesSVM (sigmoid kernel)SVM (linear kernel)SVM (rbf kernel)SVM(polynomial kernel)NBLRDTRFK-NNAccuracy (Accy)Proposed98.795.496.395.890.278.380.695.296.9Reference [62]918189909092918486Reference [63]869392929192929192Reference [61]957577797374828486Reference [64]858382899293919297Reference [65]928682929294919293Precision (Precy)Proposed0.970.980.980.890.990.320.350.990.97Reference [62]0.840.920.900.850.860.870.890.920.89Reference [63]0.920.950.930.960.930.930.950.980.99Reference [61]0.890.880.870.840.92.970.980.970.98Reference [64]0.970.950.960.980.960990.980.990.98Reference [65]0.890.880.870.840.92.970.980.970.98Sensitivity (Seny)Proposed0.970.980.990.960.800.150.870.920.85Reference [62]0.890.920.930.950.910.940.950.940.92Reference [63]0.920.940.910.900.980.940.950.920.91Reference [61]0.970.910.920.910.920.960.950.920.96Reference [64]0.910.920.900.890.960.920.930.910.92Reference [65]0.910.920.940.960.960.920.920.910.91F1-scoreProposed0.980.990.980.960.890.220.450.9491Reference [62]0.860.920.810.880.850.970.930.940.92Reference [63]0.920.920.830.920.930.910.980.960.94Reference [61]0.910.900.920.930.920.910.950.960.99Reference [64]0.960.970.920.910.910.960.950.920.91Reference [65]0.910.900.920.930.920.910.950.960.99


## 6. Conclusions and Future Research Directions

The proposed research presents a pattern recognition-based machine learning technique for selecting the most appropriate encryption technique for a specific kind of data contained in digital images. Digital images are classified into three categories based on the amount of data present in them. Images containing highly correlated data which are transferred between the IoT devices should be encrypted through EHPT, while images containing textures should be encrypted through ELPT. Several machine learning algorithms are evaluated in the proposed study in order to determine the optimal ML algorithm to achieve the desired task. SVM outperforms all other machine learning methods in terms of accuracy, and it classifies the images with an accuracy of 98.7%. As a result, it is selected for the proposed technique. Moreover, a detailed comparison reveals that the proposed technique performs better than the existing ones.In the future, we may use the proposed technique to secure digital images. Moreover, the dataset utilised in this research may be improved by incorporating more number of features.



---

*Source: 5108331-2022-07-05.xml*