# Comparative Study of Blockchain Hashing Algorithms with a Proposal for HashLEA
## 4 Proposed HashLEA Algorithm
The combined use of XOR and addition ensures that both positional and numeric differences in the input data contribute significantly to the hash computation. Figure 2: The general structure of the proposed hash function. The miniHash1 and miniHash2 values are encrypted using the LEA cipher with pre-computed round keys. The encryption process applies 24 rounds of LEA cipher operations, thereby ensuring robust mixing and security. Subsequent to encryption, the mini-hash values are modified by reapplying XOR and addition operations with the original block data, which increase cryptographic complexity across blocks by integrating nonlinear mixing, bitwise transformations, and modular arithmetic operations. The intermediate hash values from each iteration are combined into a cumulative finalHash, which maintains the chaining property. For each block group processed, the partial hash values (hash[0...3]) are added to the corresponding slots in finalHash. This aggregation ensures that even minor changes in any block affect the final output hash. By means of an iterative process of addition and XOR operations, the algorithm propagates modifications throughout the hash, thereby achieving the desired avalanche effect. Furthermore, the design guarantees that the final hash output is resistant to collisions and highly responsive to alterations in the input data. The pseudocode for the HashLEA function outlines the step-by-step process of generating a cryptographic hash from input data in Algorithm 1. The pseudocode focuses on simplicity and clarity, providing a high-level view of the function's logic without delving into implementation-specific details. Key steps in the pseudocode include initializing variables for intermediate and final hash values, applying XOR and addition operations to compute mini-hashes, and encrypting these mini-hashes to enhance security. The results of each iteration is added to a cumulative hash value, ensuring that all input data contribute to the final output. In the pseudocode, the modularity of the process is revealed whereby the operations on each group of blocks are isolated and independently combined. Abstraction puts into focus only the core design principles of the hash function--iterative processing, encryption, and mixing operations--so the function's structure is easy to understand and adaptable for different cryptographic needs. Also, the HashLEA function is implemented in C in order to take advantage of the language's efficiency and low-level memory control that is so important for cryptographic applications. ```
Input :\(M_{1},M_{2},...,M_{t}\); \(M_{i}=(m_{128}^{128}||m_{128}^{128}||...||m_{r}^{128})\); \(r=0,1,...,(digest/32)\) for each group of 8 blocks in data do \(miniHash1\leftarrow\bigoplus_{i=1}^{8}block_{i}\) (XOR all 8 blocks) \(miniHash2\leftarrow\sum_{i=1}^{8}block_{i}\) (ADD all 8 blocks) endfor \(miniHash1\gets Encrypt(miniHash1,roundKeys)\) \(miniHash2\gets Encrypt(miniHash2,roundKeys)\) for i = 1 to 8 do \(miniHash1\gets miniHash1\bigoplus_{i=1}^{8}block_{i}\) \(miniHash2\gets miniHash2\bigoplus_{i=1}^{8}block_{i}\) endfor for k = 0 to 1 do \(hash[k]\gets miniHash1[k]\) \(hash[k+2]\gets miniHash2[k]\) endfor for k = 0 to 3 do \(finalHash[k]\gets finalHash[k]+hash[k]\) endfor endfor Return finalHash
```  
**Algorithm 1** HashLEA