# Study About the Performance of Ascon in Arduino Devices
## 5 Performance Analysis of the Ascon Implementation
### Measures in the Encryption/Decryption Operations with AES  
To test the speed of Ascon, the Advanced Encryption Standard cryptographic algorithm [58], with a 128-bit key (AES-128), is introduced in the comparison as this is frequently used in LwC to secure constrained environments. We used the AES implementation that is available in the Github repository [59]. This is a standard implementation of this algorithm, and, moreover, we have chosen this tiny-AES version because it is a version that takes \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \multirow{2}{*}{**Name**} & \multicolumn{2}{c}{**Nano ESP32**} & \multicolumn{2}{c}{**DUE**} & \multicolumn{2}{c}{**Nano Every**} & \multicolumn{2}{c}{**Mega250**} \\ \cline{2-9}  & **Enc.** & **Dec.** & **Enc.** & **Dec.** & **Enc.** & **Dec.** & **Enc.** & **Dec.** \\ \hline Average & 10,855.3 & 10,718 & 2566.6 & 2573.6 & 79.3 & 79.3 & 75 & 74.6 \\ \hline \hline \end{tabular}
\end{table} 
Table 13: Averages for the number of encryption and decryption operations in one second for all versions of Ascon family in the Arduino devices \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \multirow{2}{*}{**Variant**} & \multicolumn{5}{c}{**Number of Cycles and Encryptions in the Encryption Process. Linux PC**} \\ \cline{2-9}  & **\# Cyc. (1 s)** & **\# Enc. (1 s)** & **\# Cyc. (5 s)** & **\# Enc. (5 s)** & **\# Cyc. (10 s)** & **\# Enc. (10 s)** \\ \hline Ascon-128 & 3,591,863,479 & 291,229 & 17,958,761,656 & 1,472,122 & 35,918,379,472 & 2,957,498 \\ Average & 12,333 & — & 12,199 & — & 12,144 & — \\ Ascon-128a & 3,591,926,172 & 314,703 & 17,958,959,274 & 1,566,612 & 35,917,241,994 & 3,144,722 \\ Average & 11,413 & — & 11,463 & — & 11,421 & — \\ Ascon-80 pq & 3,591,780,396 & 287,878 & 17,959,007,943 & 1,441,062 & 35,924,275,362 & 2,637,573 \\ Average & 12,476 & — & 12,462 & — & 13,620 & — \\ \hline \hline \end{tabular}
\end{table} 
Table 14: Number of cycles (Cyc.) and encryptions (Enc.) in the encryption operation in a PC with Linux for the three versions of Ascon. up very little memory, it has no countermeasures, and when encrypting and decrypting a single block, it does not have the ECB operating mode implemented. We are aware that Ascon and AES are not comparable systems since the properties and characteristics of each are different. However, we include a comparison between them because it can allow the reader to obtain an idea of the efficiency and requirements associated with the implementations of each. This comparison is for information purposes only. As in the case of the implementation of Ascon in the four Arduino devices, the generation of random keys and random data for AES has been done using the rand() function implemented by the Arduinos. This fact does not interfere with or deteriorate the data obtained since this is done with the same function for all versions of Ascon family and AES. In particular, in the case of AES, the complete function to generate keys and random data is simper than in the case of Ascon and it is shown as Algorithm 8. ```
void RandGen(){ for(i = 0; i < 16; i++){ plain[i] = rand()%0 xFF; key[i] = rand()%0 xFF; } }
```  
**Algorithm 8** Random keys and random data for AES. Tables 16 and 17 show the number of cycles and the number of encryption and decryption operations for AES-128 considering the encryption and decryption processes, respectively, for three Arduino devices: Arduino DUE, Arduino Mega2560, and Arduino Nano ESP32. Here, it is important to emphasize that Arduino Nano Every is not able to support the same AES-128 implementation because it is not able to execute the algorithm due to its memory limitation. On the other hand, the number of encryptions and decryptions of the Arduino Nano ESP32 for AES-128 is considerably higher than that of the other two devices. In fact, this number is between 43 and 48 times higher than that of the Arduino Mega2560 and between 5 and 7 times higher than that of the Arduino DUE.