# A Lightweight Image Cryptosystem for Cloud-Assisted Internet of Things
## 3 Materials and Methods
### Proposed Lightweight Image Cryptography Algorithm
However, in most of the cases, HXP produced a lower value of MSE than the algorithm proposed by the authors of [57]. These results showed that the algorithm outlined by the authors of [57] has a better MSE than the HXP algorithm. Lower values of chi-square are desirable. From Table 12, it can be seen that the HXP algorithm has a lower value of chi-square in most cases than the existing algorithms. These results are proof that HXP is more resistant to histogram analysis attacks. Generally, the comparative analysis of HXP revealed that HXP performs better than the existing algorithms in terms of security in most cases. It can therefore be said that HXP is more secure than the existing algorithms. \begin{table}
\begin{tabular}{c c c c c c c} \hline
**Metrics** & **Algorithm** & **airplane.tiff** & **baboon.tiff** & **boat.tiff** & **lena.tiff** & **pepper.tiff** \\ \hline PSNR & HXP & 8.0041 & 9.5204 & 9.2952 & 9.2399 & 8.8704 \\  & [57] & 7.9804 & 9.4722 & - & 8.55 & 8.8807 \\  & [58] & & 9.5466 & & 9.2322 & 8.9914 \\  & [59] & - & 9.400680 & 9.312557 & 9.287804 & - \\  & [60] & - & 9.4474 & 9.2653 & 8.5731 & 8.9603 \\ \hline NCC & HXP & \(-0.0016\) & 0 & 0.0009 & 0.0022 & \(-0.002\) \\  & [57] & \(-0.00004\) & 0.00257 & - & \(-0.0023\) & \(-0.011567\) \\  & [58] & & \(-0.006632\) & & 0.002851 & \(-0.001650\) \\  & [60] & - & \(-0.00070284\) & \(-0.00302940\) & 0.003389097 & 0.002385462 \\ \hline MSE & HXP & 10,296.1584 & 7261.712 & 7648.1358 & 7746.154 & 8434.092 \\  & [57] & 10352 & 7343 & - & 9080 & 8414 \\  & [60] & - & 7385 & 7701 & 9032 & 8261 \\ \hline \end{tabular}
\end{table} 
Table 13: Comparative security analysis of HXP with existing systems. \begin{table}
\begin{tabular}{c c c c c} \hline
**Line \#** & **Mem usage** & **Increment** & **Occurrences** & **Line contents** \\ \hline
107 & 55.0 MiB & 55.0 MiB & 1 & @ profile \\
108 & & & & def reversebitmodification(encesed, ciphertext, bsize): \\
109 & 55.0 MiB & 0.0 MiB & 1 & reversebinX = bytestobinary(ciphertext) \\
110 & 55.0 MiB & 0.0 MiB & 1 & confusionkey = randgen(encesed,len(reversebinX)) \\
111 & 55.0 MiB & 0.0 MiB & 1 & reversebinX = reshufferoderception(confusionkey, reversebinX) \\
112 & 55.0 MiB & 0.0 MiB & 1 & reinbble = reversebinX[0: len(reversebinX)/ /2] \\
113 & 55.0 MiB & 0.0 MiB & 1 & reinbble = reversebinX[len(reversebinX)//2: len(reversebinX)] \\
114 & 55.0 MiB & 0.0 MiB & 2051 & Xornibble = [str(int(inbubble[j])’int(mribble[j])) for j in range(len(inbible))] \\
115 & 55.0 MiB & 0.0 MiB & 1 & Xornibble = \({}^{\prime}\),join(xornibble) \\
116 & 55.0 MiB & 0.0 MiB & 1 & rhibble = \({}^{\prime}\),join(mribble) \\
117 & 55.0 MiB & 0.0 MiB & 1 & reversebinX = xornibble + mribble \\
118 & 55.0 MiB & 0.0 MiB & 1 & revtext = list (binarytobytes(reversebinX)) \\
119 & 55.0 MiB & 0.0 MiB & 1 & return revtext \\ \hline \end{tabular}
\end{table} 
Table 12: Memory utilization of the decryption module during python implementation. ## 5 Justification of The Suitability of HXP on Resource-Staved IOT Devices

HXP takes after ARX. In ARX, AND, rotation, and XOR operations are used alongside the Feistel structure to achieve non-linearity, diffusion, and confusion properties, which ensure the security of the LWC algorithm. In HXP, the Secure Hash Algorithm (SHA), XOR, and bit permutation operations are used in conjunction with the Feistel structure to achieve non-linearity, diffusion, and confusion properties. Variants of SHA for LWC exist [64]; bit permutations are inexpensive operations that are commonly used to achieve diffusion [65], and of course XOR operations can easily be executed on resource-constrained IoT devices. Hence, HXP can be used on resource-constrained devices. HXP has an advantage over the existing ARX structure, because while ARX can only diffuse half of the block in one round [39], HXP has the capability of diffusing an entire block in a single round. This is achieved through the permutation of the bits that follow the XOR operation.