# Provide a New Encryption Algorithm for Medical Images and Evaluate the Proposed Algorithm

#### Abstract

### Introduction:

In this paper, an encryption algorithm for the security of medical images is presented, which has extraordinary security. Given that the confidentiality of patient data is one of the priorities of medical informatics, the algorithm can be used to store and send medical image.

### Material and Methods:

In this paper, the solutions of chaotic differential equations are used to generate encryption keys. This method is more than other methods used in encoding medical images, resistant to statistics attacks, low encryption and decryption time and very high key space. In the proposed algorithm, unlike other methods that use random key generation, this method uses the production of solutions of the chaotic differential equations in a given time period for generating a key. All simulations and coding are done in MATLAB software.

#### INTRODUCTION

For ensuring the safety of medical data in a computer environment, one of the proposed ways is encrypting data. When the user sends his message, after clicking on the submit button, the message text is encrypted using a predefined encryption key and encrypted by the particular algorithm and placed in the communication channel. After being received by the user, it is decrypted by the key. To protect data, unauthorized access to encryption, concealment, and intrusion is used [1].

Among these three methods, encryption has become one of the important tools for providing a high level of security. The main idea and key of the theory of chaos is that in any disorder, the order lies. In that sense, order should not be searched on a single scale. A phenomenon that appears on a local scale is completely random and unpredictable. That is likely to be quite robust and predictable on a larger scale. Circular rotation of encryption keys is a common mechanism for increasing the security of encryption methods. In this method, the turbulent rotation, in which the rotation of the pairs and repetitive mappings causes periodic circulation in chaos sets, is introduced as a new encryption method combining chaotic behavior with periodic key changes [2].

In previous years, the ideas and methods of the theory of dynamical systems and chaos have been considered in various fields such as communication and encryption [3-8].

For example, this method is used to coordinate messaging systems in messaging systems. The main idea is that the sender generates a chaotic signal to cover the message sent as the raw text. At the receiving point, the secondary chaos system coincides with the received signaling signal, which is called cipher text. Then a simple subtraction operation displays the message. There are other ideas for sending encrypted messages based on chaos control basic theory and research. The unpredictable irregular behavior of many nonlinear systems is described as chaos. One of the main characteristics of chaotic systems is that it does not repeat its past behavior (even approximately). Another characteristic of dynamic systems that exhibits chaotic behavior is that such systems must necessarily include at least one nonlinear expression [9-11].

#### MATERIAL AND METHODS

In order to protect the medical and patient data about the confidentiality of information, we need methods in place to prevent unauthorized access. The methods that enable us to achieve this are encryption methods. Any medical data, including text data and image data obtained through medical devices and medical devices, can be converted to an image using a scanner. The image is converted into a matrix using the software, so that each bar of this matrix shows the color intensity of each pixel.

In the following, we can make the necessary changes, such as compression (using Fourier transforms and wavelets), and encryption on medical data using the created matrix. The medical data encoding topic can also be used to store information in the medical records and health records, as well as in the telemedicine section for sending medical pictures. The process is shown in Fig 1.

This article focuses on encoding medical images. Each encryption system that we use for encryption consists of two parts of the encryption (for the sender part) and decryption (for the receiver part). The algorithm used to encrypt chaotic differential equations solutions is used. To detect encrypted data, decryption should be done, using the concept of synchronization.

The system provided for synchronization

In this section, based on the Laplace transform theory, we construct a synchronization system with the PC method. Consider the fractional model similar to the Chen system described below [12]

$\left\{\begin{array}{c}{D}^{{a}_{1}}x=a\left(y-x\right),\\ {D}^{{a}_{2}}y=\mathit{dx}-\mathit{xz}+\mathit{cy},\\ {D}^{{a}_{3}}x=\mathit{xy}-\mathit{bz},\end{array}\right.$

Where ${a}_{i}$ are fractional order derivatives of the state variables (^{x,y,z}) and (^{a,b,c,d}) are system parameters.

${D}^{a}f\left(t\right)$ : Represents the Caputo fractional derivative of the order ($\mathit{\alpha \u03f5}$) defined as follows:

${D}^{a}\mathit{f}\left(t\right)=\frac{1}{\mathrm{\Gamma}(n-a)}{\int}_{0}^{t}\frac{{f}^{n}}{{(t-\tau )}^{a-n+1}}\mathit{d\tau},\mathit{n}-1\alpha n,$

Which $\mathrm{\Gamma}\left(z\right)={\int}_{0}^{\infty}{e}^{-t}{t}^{z-1}\mathit{dt}$ is the Gama Euler's function. Equation (1) offers chaotic behavior with

$({\alpha}_{1}=0.9,{\alpha}_{2}=0.95,{\alpha}_{3}=0.95,\mathit{\alpha}=35,b=3,c=28,d=-7)$

().

Now master-slave PC system is build [3]. First consider the base system as the model (1) by assuming that the index of state variables are shown with m that is the first letter is the word (master).

and we consider the follower system with index s that is the first letter is the word (slave).

By assuming ${e}_{1}={x}_{s}-{x}_{m},{e}_{3}={z}_{s}-{Z}_{m}$ , the error system for equations (2) and (3) is obtained as follow:

Now, by applying Laplace transform to two sides of the equation (4) and assuming and using we have:

From equation (5) we can conclude that

By using the Laplace transform properties, we have:

Since E is bounded, it follows that $\underset{t\to \infty}{\mathrm{lim}}{e}_{3}\left(t\right)=0.$

So, synchronization is established between the base system and the follower system. We simulate the synchronization between the base system and the follower. The parameters used are the same parameters used in equation (1), and the initial conditions for the base and the follower systems are respectively (2.2, 2.4, 28) and (18, 8). The synchronization error's diagrams are shown in Fig 2 and 3, which show that the error in the limited time period tends to zero and synchronization works correctly.

Presentation of image encryption algorithm based on chaotic fractional system

Using the chaotic system introduced in the previous section, we introduce chaotic encryption for images. In the transmitter, the system generates a chaos signal. To perform the synchronization operation, one of the variables must be selected as the agent variable; we use ${y}_{m}$ for this purpose. Next, mix the generated chaotic sequence with the original image matrix data to get the encrypted image. The general schema of encryption and decryption process is shown in Fig 4. In the following, we describe the algorithm in a stepwise manner.

Encryption algorithm

Assume that the matrix form of the original image be the matrix (which is *M, N* respectively the size of the row and column of the matrix). The pixels are arranged, respectively, from left to right and from top to bottom as numbers in the basis of ten.

Simulate the base-follower system in the software and make sure the synchronization operation is done correctly.

After achieving the synchronization, generate a vector with the size from the solutions of the chaotic fractional order system; Then form the chaotic decimal sequence form such as:

.

And *de2bi* Converts the decimal value to its binary value, so the code set is in the form

**Decrypt**The decryption process is similar to encryption, with the difference that we are using a follower system at this stage.

#### Results

Here we simulate the simulation results for the method presented in the MRI image. Fig 5a shows the original image whose equivalent histogram is shown in Fig 5b. In simulating chaos signals after synchronization, we generate 65536 samples. In Fig 5c and 5d, respectively, we encoded the image using the proposed algorithm and its equivalent histogram. The decoded image and the corresponding histogram are also depicted in Fig 5e and 5f. The results of Fig 5 show that the proposed algorithm works correctly. The encoded image is completely different from the original image, and the encrypted image is successfully retrieved, which is very close to the original image.

Evaluation of provided encryption algorithm

By applying an image encryption algorithm, the amount of pixels in the image varies from that of the original image. A strong encryption algorithm should perform these changes at the maximum and most significant variation levels for the pixel values in the original image and image encoded. Also, to get an encrypted image, you must create random patterns that do not reveal any of the original image forms. The encoded image should have a very little dependency on the original image. One of the most important criteria for evaluating an encrypted image is visual inspection:

The more specific the image cached, the better the encryption algorithm gets. Criteria are used to measure the degree of encryption. Scattering is an important parameter that must be measured to judge the randomness of the encryption algorithm. If the algorithm has a good dispersion characteristic, the relationship between the encoded image and the original is very complicated and cannot be easily predicted. To measure the dispersion of any algorithm, one bit changes in the original image and obtains the difference between the encoded image obtained from the original image and the image obtained by changing a bit. In the following, we describe the criteria for evaluating the encryption algorithm [13].

Algorithm assessment criteria

In this section, two sets of encryption evaluations are discussed; the first one measures the ability of the encryption algorithm to replace the original image with an uncoordinated encoded image. In this category, five criteria were studied: histogram difference, correlation coefficients , irregular difference of histogram unevenness and difference from idealism. The second category measures the scattering property of the encryption algorithm. In this category, three criteria are studied: the effect of a sudden fall, the rate of change in the number of pixels (*NPCR*) and the capacity to change the mean of uniformity (*UACI*).

Histogram difference

Differences in histogram evaluate the encoding quality in terms of how to maximize the difference between the original images and encrypted it. The steps to calculate this benchmark are as follows:

1) Draw a histogram of the original image and it's encrypted

2) Estimate the net difference between two histograms

3) Estimates of the area under the difference curve divided by the whole image as follows

which is the net difference domain in the category and are the dimensions of the image we want to encrypt. The large amount of will improve the quality of the encoded image. Although this criterion gives good results in returning the encoded image from the original image, but it cannot be used alone to measure encryption quality due to some limitations.

Entropy analysis of information

The entropy of information is calculated in the form of the following formula:

where indicates the appearance possibility of the corresponding information. The entropy of information for an image means the dispersion of gray values. The ideal value is equal to entropy. The difference between the amounts of entropy for an encrypted image near this value is, of course, to indicate that the encryption algorithm is better. The calculations for the proposed algorithm show that the entropy for an encrypted image using the proposed algorithm is equal to that which is very close to the ideal value.

Correlation coefficients

One of the important criteria for evaluating the encryption quality of each image password system is the correlation coefficients between the pixels in the same profile in the encrypted image and the original image. This criterion can be calculated as follows:

which is the original and encrypted images respectively. In numerical calculations, the following formulas can be used to calculate correlation coefficients

where is number of pixels involved in the calculation. The closer value of to zero, indicate the better qualify of encryption algorithm.

In our article, 3,000 pairs of pixels were randomly selected close to each other horizontally from the original and encrypted images, in which case we conclude that.

Histogram uniformity

For a histogram, a graph of the bar indicates a grayish image for the event. The vertical axis represents the gray level. This axis starts from zero and goes up to higher gray levels. Each horizontal bar shows the number of events corresponding to the intensity of the gray color in the image. For each encoding algorithm, the histogram of the encrypted image must have the following two properties:

1) The whole histogram of the original image should be different from the encoded image.2) The encoded image should have a uniform distribution, which means that the probability of occurrence of each color intensity is equal.

Space key

A secure encryption algorithm should have a key space greater than 2^{100} to be under the threat checking of all states [14]. In the proposed algorithm, the space of the key is obtained as follows: the initial conditions and the derivative order of the fraction , for initial conditions, range from 0 to 65535 with a length of step of 0.001 to 65535, and for derivatives of the range of 0. 934464 to 0.999999 with a step length of 0.000001 to 65535, which for 8 private keys is a total of 2^{128}, which is above 2^{100}; therefore, encryption algorithm using chaotic differential equations, can provide a high level of security for key space to create.

#### DISCUSSION

In this section, the Comparison of the encryption algorithm provided with the AES encryption algorithm. In this paper, the comparison is done on two images; the average results for these states are presented in Tables 1 and 2. Selected images include MRI and chest (chest photo), as shown in Fig 6a and 6b, respectively.

#### Table 1

Comparison of the Encryption Algorithm Provided with the AES Algorithm for Mary Image

#### Table 2

Compare Encryption Algorithm Provided with AES Algorithm for Chest Image

#### CONCLUSION

In this paper, an algorithm was proposed for encoding medical images that is essential for the safety of patient data. The proposed method is known as chaotic encryption method. Given that each encryption algorithm consists of two parts of encryption and decryption, the proposed algorithm is not excluded from this rule. In the encryption section for generating keys, we generated responses to chaotic differential equations, and then we mixed the keys with the image pixel values, which resulted in the encrypted image. The decoding concept of synchronization was used later. There are various ways to synchronize chaotic systems, such as full synchronization, sliding mode, linear feedback, and other synchronization methods, for example, in which full synchronization was used. To measure the efficiency and degree of assurance of the proposed method, it was necessary to compare with the encryption algorithm used in the images.

In this paper, the chaotic algorithm was compared with the AES encryption method. The ranking of two algorithms showed that the chaotic algorithm works better and has high security. Given that the method is not only theoretical but also practical, it can be used to maintain the privacy rights of patient information, this method can be used in hospital archiving systems.

#### References

*Physics Letters A*2007;370(1):35–9. [CrossRef]

*Phys Rev Lett*1990;64(8):821–4. [PubMed] [Google Scholar] [CrossRef]

*Communications in Nonlinear Science and Numerical Simulation*2009;6(14):2793–806. [CrossRef]

*Communications in Nonlinear Science and Numerical Simulation*2012;4(17):1706–13. [CrossRef]

*Optik*2014;20(125):5920–25. [CrossRef]

*Communications in Nonlinear Science and Numerical Simulation*2016;39:108–17. [CrossRef]

*Annual Reviews in Control*2005;29(1):33–56. [CrossRef]

*Nonlinear Analysis: Theory, Methods & Applications*2009;12(70):4393–401. [CrossRef]

*Chinese Physics B*2013;4(22):1–7.

*Chaos, Solitons & Fractals*2007;1(31):119–29. [CrossRef]

*Nonlinear Dynamics*2012;67(1):893–901. [CrossRef]

*Signal Processing*2018;142:292–300. [CrossRef]

*International Journal of Engineering Trends and Technology (IJETT)*2016;33(3):126–9. [CrossRef]