# A Lightweight Image Cryptosystem for Cloud-Assisted Internet of Things
## 3 Materials and Methods
### Proposed Lightweight Image Cryptography Algorithm
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Image** & **Plain image** & **Encrypted image** \\ \hline airplane.tiff & 6.66391 & 7.99934 \\ baboon.tiff & 7.76244 & 7.99941 \\ boat.tiff & 7.19137 & 7.99932 \\ lena.tiff & 7.7502 & 7.99941 \\ pepper.tiff & 7.66983 & 7.99927 \\ \hline \hline \end{tabular} Analysis of Memory Utilization during the Encryption and Decryption Processes of the HXP

Tables 11 and 12 show the memory utilization by each line in the code when the encryption and decryption modules were implemented in python, respectively.

\end{table} 
Table 11: Memory utilization of the encryption module (Figure 2a) during python implementation. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Image** & **Plain image** & **Encrypted image** \\ \hline airplane.tiff & 6.66391 & 7.99934 \\ baboon.tiff & 7.76244 & 7.99941 \\ boat.tiff & 7.19137 & 7.99932 \\ lena.tiff & 7.7502 & 7.99941 \\ pepper.tiff & 7.66983 & 7.99927 \\ \hline \hline \end{tabular}
\end{table} 
Table 10: Entropies of the plain images in Figure 3f-j and the encrypted images in Figure 3k\(-\)o. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Image** & **Plain image** & **Encrypted image** \\ \hline airplane.tiff & 6.66391 & 7.99934 \\ baboon.tiff & 7.76244 & 7.99941 \\ boat.tiff & 7.19137 & 7.99932 \\ lena.tiff & 7.7502 & 7.99941 \\ pepper.tiff & 7.66983 & 7.99927 \\ \hline \hline \end{tabular} Analysis of Memory Utilization during the Encryption and Decryption Processes of the HXP

Tables 11 and 12 show the memory utilization by each line in the code when the encryption and decryption modules were implemented in python, respectively.

\end{table} 
Table 10: Entropies of the plain images in Figure 3f-j and the encrypted images in Figure 3k\(-\)o. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Line \#** & **Mem usage** & **Increment** & **Occurrences** & **Line contents** \\ \hline
92 & 168.8 MiB & 168.8 MiB & 1 & @ profile \\
93 & & & & def bitmodification(encesed, encryptedtext, bsize): \\
94 & 168.8 MiB & 0.0 MiB & 1 & encryptedtext = bytestobinary(encryptedtext) \\
95 & 168.8 MiB & 0.0 MiB & 1 & confusionkey = randgen(encesed,len(encryptedtext)) \\
96 & 168.8 MiB & 0.0 MiB & 1 & Inibble = encryptedtext [0: len(encryptedtext)//2] \\
97 & 168.8 MiB & 0.0 MiB & 1 & rhibble = encryptedtext[len(encryptedtext)//2] \\
98 & 168.8 MiB & 0.0 MiB & 1 & xornibble = [str(int(in(Inibble[i])!int(rink[i])) for i in range(len(Inibble))] \\
99 & 168.8 MiB & & & Xornibble = \"join(xornibble) \\
100 & 168.8 MiB & 0.0 MiB & 1 & fullbyte = \"join(lxornibble, rhibble]) \\
101 & 168.8 MiB & 0.0 MiB & 1 & fullbyte = reshuffleforencryption(confusionkey,fullbyte) \\
102 & 168.8 MiB & 0.0 MiB & 1 & encryptedtext = \"join(fullbyte) \\
103 & & & & \"semportedtext = \"join(reshuffleforencryption(confusionkey,fullbyte)) \\
104 & & & & \"semportedtext = binarytobytes(encryptedtext) \\
105 & 168.8 MiB & 0.0 MiB & 1 & encryptedtext = list(binarytobytes(encryptedtext)) \\
106 & 168.8 MiB & 0.0 MiB & 1 & return encryptedtext \\ \hline \hline \end{tabular}
\end{table} 
Table 11: Memory utilization of the encryption module (Figure 2a) during python implementation. ### Comparative Security Analysis of HXP with the Existing Cryptosystems

Table 13 compares the security of HXP with the existing cryptosystems. The values EQ and entropy of HXP were found to be higher than what was obtainable in other algorithms. These result show that HXP has a better encryption quality and higher diffusion and confusion properties compared to other algorithms under consideration. The lower values of PSNR and NCC are desirable between the plain and encrypted image pixels. From Table 13, the PSNR and NCC values obtained from the analysis of HXP were found to be higher in some images than the PSNR and NCC values produced from the analysis of the existing algorithms. However, the differences observed were within the experimental error limits. These results also attest to the good encryption quality of HXP. The higher values of the MSE were desirable.