# Comparative Study of Blockchain Hashing Algorithms with a Proposal for HashLEA
## 5 Security and Performance Analysis
### Distribution of Hash Values  
It is critical for the hash value to have a uniform distribution so that it will be able to resist pre-image and second pre-image attacks effectively. If the hash function has some vulnerability, then brute-force attacks can be used to determine the first or second pre-image. There are also faster pre-image attacks that arise from cryptanalysis targeting specific hash functions. To assess the uniformity of the hash value distribution, 2000 random input data are generated and the frequency distribution of the hash values is analyzed. The frequency of each hexadecimal character in the hash output is calculated to assess the uniformity of the distribution. It is expected that each hexadecimal character should appear in approximately equal numbers.  
To further assess the distribution, a chi-square test (Equation (5)) is performed as a goodness-of-fit test to determine whether the hash values are uniformly distributed across all 256-bit versions of the proposed hash function. In order to evaluate the distribution of the hexadecimal characters, a random sample of 2000 messages is selected. The number of expected occurrences of each hexadecimal character (denoted as \(E_{i}\)) is calculated to be 8000. The observed occurrences (\(O_{i}\)) for the hexadecimal characters are presented in Table 2.  
\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline  & \(B_{c}min\) & \(B_{c}max\) & \(Avr.B_{c}\) & \(R_{c}\%\) & \(\bigtriangleup R_{c}\) (\%) & \(\bigtriangleup B_{c}\) \\ \hline
**X11** & 102 & 151 & 127.97 & 49.99 & 3.15 & 8.07 \\
**X13** & 102 & 153 & 128.17 & 50.07 & 3.05 & 7.8 \\
**X15** & 101 & 154 & 127.58 & 49.84 & 3.09 & 7.91 \\
**X17** & 101 & 151 & 127.8 & 49.92 & 3.19 & 8.18 \\
**Scrypt** & 102 & 158 & 127.58 & 49.84 & 3.09 & 7.9 \\
**Quark** & 99 & 154 & 128.2 & 50.08 & 3.11 & 7.96 \\
**Kecak** & 106 & 157 & 128.3 & 50.12 & 3.1 & 7.94 \\
**Xevan** & 102 & 157 & 128.11 & 50.04 & 3.06 & 7.83 \\
**Fugue** & 102 & 154 & 128.14 & 50.05 & 3.19 & 8.16 \\
**Groesti** & 104 & 156 & 128.09 & 50.03 & 3.16 & 8.09 \\
**Myr-Groesti** & 106 & 157 & 128.36 & 50.14 & 3.2 & 8.19 \\
**SHAvite-3** & 104 & 156 & 127.79 & 49.92 & 3.03 & 7.75 \\
**Skein** & 103 & 151 & 127.63 & 49.86 & 3.05 & 7.82 \\
**Lyra2z** & 101 & 153 & 128.26 & 50.1 & 3.12 & 7.99 \\
**Lyra2 re** & 102 & 158 & 127.88 & 49.95 & 3.22 & 8.25 \\
**Lyra2 REv2** & 104 & 154 & 127.86 & 49.94 & 3.12 & 8 \\
**Blake** & 103 & 154 & 128.47 & 50.19 & 3.29 & 8.41 \\
**HashLEA** & 102 & 155 & 128.06 & 50.02 & 3.04 & 7.8 \\ \hline \hline \end{tabular}
\end{table}
Table 1: The statistical analysis of hash functions.  
\begin{table}
\begin{tabular}{l c c c c c c c} \hline \hline  & \multicolumn{6}{c}{**Hexadecimal Characters**} \\ \hline  & **0** & **1** & **2** & **3** & **4** & **5** & **6** & **7** \\
**Frequency** & 8160 & 7966 & 7989 & 7940 & 8038 & 7977 & 7987 & 8034 \\  & **8** & **9** & **A** & **B** & **C** & **D** & **E** & **F** \\
**Frequency** & 7981 & 7996 & 8110 & 7896 & 8041 & 7851 & 8000 & 8034 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Occurrence frequency.  
The calculated chi-square value (\(X_{c}\)) indicates that the null hypothesis (\(H_{0}\), asserting that the hash values are uniformly distributed) is confirmed for any alpha \(\alpha\) value. Based on the results, the chi-square value demonstrates that the distribution of hexadecimal characters produced by the hash function is statistically uniform. The set of hexadecimal characters is comprised of the range 7851 to 8160 for the HashLEA-256. The critical chi-square value is 10.26, which exhibits a minimal deviation from the expected outcome.  
\[X_{c}^{2}=\sum\frac{\left(O_{i}-E_{i}\right)^{2}}{E_{i}} \tag{5}\]