# A Lightweight Image Cryptosystem for Cloud-Assisted Internet of Things
## 3 Materials and Methods
### Proposed Lightweight Image Cryptography Algorithm
* Procedure for system sensitivity analysis: Key sensitivity and plain image sensitivity were used to test the system's sensitivity via the following statistical procedures:
* Key sensitivity: A key, K, was randomly generated. A single bit at a random location within the bits of K was flipped to obtain another key, K1. The keys K and K1 were used in turns to encrypt the image P to obtain the cipher images C and C1, respectively. Metrics 3-11 were used to compare C and C1. This procedure was repeated for each of the test images. * Plain image sensitivity: A key, K, was randomly generated. A single bit within the bits of an image P at a random location was flipped to obtain another image, P1. Both the P and P1 images were encrypted using key K to obtain the cipher images C and C1, respectively. Metrics 3-11 were used to compare C and C1. This procedure was repeated for each of the test images. 3. Cipher image sensitivity: A key, K, was randomly generated. A plain image, P, was encrypted using the proposed image encryption algorithm to form the cipher image, C. A single bit within the bits of image C was flipped at a randomly selected location within the bits of image C to obtain another cipher image, C1. Both C and C1 were decrypted using the decryption algorithm of the proposed image cryptosystem and key K to obtain the decrypted images D and D1, respectively. Metrics 3-11 were used to compare D and D1. This procedure was repeated for each of the test images. iv. Statistical analysis procedure: The purpose of statistical analysis is to test the algorithm in order to ascertain its resistance to statistical attacks. Histograms, the adjacent pixel correlation coefficient, and entropy analysis were employed in this case as follows: 1. Histogram analysis procedure: For each of the test images, histograms of the plain image and that of the cipher image were taken and the Chi-square test was used to verify the uniformity of each histogram. 2. The adjacent pixel correlation coefficient: A thousand randomly selected pixels along the horizontal, vertical, and diagonal directions of each of the test images were plotted on scatter graphs for each direction. The same was conducted for each of the cipher images obtained from each test image. The correlation coefficient, in each case, was also calculated to verify the resistance of the cryptosystem against correlation coefficient attacks. c. Entropy analysis: Each of the test images were encrypted using the proposed encryption scheme. Entropy analysis, as specified by Equation (23), of both the plain and cipher images were measured. ## 4 Results and Discussions

In this section, the experimental results and the results of comparison of HXP with the existing algorithms are discussed. Implementation of the HXP was carried out on a laptop with the following configuration: \begin{tabular}{l l} Processor & AMD E1\(-\)1200 APU with Radeon(tm) HD \\  & Graphics 1.40 GHz \\ Installed RAM & 4.00 GB (3.59 GB usable) \\ Device ID & E4C0446D\(-\)57F5\(-\)4475\(-\)8A60-F1D4A41F6048 \\ Product ID & 00331\(-\)10000\(-\)00001-A508 \\ System type & 64-bit operating system, x64-based processor \\ \end{tabular} 

### Discussion of Experimental Results

1. Simulation results: Figure 3 shows the simulation results. The input images are shown in Figure 3a-e. The outputs of these images following their conversion into grayscale images are shown in Figure 3f-j. The resulting images when the images in Figure 3f-j are subjected to the encryption process are shown in Figure 3k-o, and Figure 3p-t represent the images recovered from the decryption of the images in Figure 3k-o. By visual inspection, the images in Figure 3k-o are very different from the images in Figure 3f-j. Comparing the images through visual inspection also shows that Figures 3f-j and 3p-t are identical.