# Comparative Study of Blockchain Hashing Algorithms with a Proposal for HashLEA
## 4 Proposed HashLEA Algorithm  
This section provides a detailed explanation of the proposed hash function, HashLEA, which employs lightweight encryption techniques to facilitate efficient and secure hashing. The LEA cipher is chosen as the core of HashLEA due to its high performance and suitability for resource-constrained environments. In a previous study (referenced in [87]), we conducted a comparative analysis of several block cipher algorithms and selected high-performance algorithms for cryptographic operations. Among the top contenders, LEA demonstrated particularly strong performance in terms of both speed and energy efficiency. LEA is optimized for low-resource environments, offering remarkable performance while maintaining robust cryptographic properties. This made it an optimal selection for HashLEA, as our objective is to develop a distinctive hash structure that could fulfill the particular requirements of IoT-blockchain integration. By using LEA as the basis, HashLEA benefits from its high performance, ensuring fast processing times and low energy consumption, which is critical for IoT applications. The proposed scheme (Figure 2) incorporates block processing, addition and XOR-based mini-hashing, and final hash aggregation to achieve desired cryptographic properties such as collision resistance and the avalanche effect. In HashLEA, we use the LEA cipher with a 128-bit block size and 24 rounds. These parameter choices are made based on the performance and security trade-offs in cryptographic algorithms, as well as standard practices in lightweight cipher design. The 128-bit block size is a common choice for lightweight ciphers, as it strikes a balance between computational efficiency and security. This size is large enough to provide a high level of security while not overly burdening the limited resources of IoT devices. Additionally, this block size is consistent with other block ciphers like Speck and Simon, which are widely used in IoT applications. The selection of 24 rounds for the LEA cipher is guided by security evaluations and known attacks. In the context of cryptanalysis, the highest number of rounds affected by attacks such as Boomerang and Differential Linear has been reported to be 15 rounds. Therefore, selecting 24 rounds, which is the original design parameter of LEA, provides a significant security margin, ensuring resistance against these known attacks while maintaining computational efficiency. This choice balances robust security with fast processing, making it suitable for IoT environments. The input data are divided into 128-bit sub-blocks (\(m_{0}\), \(m_{1}\), \(m_{2}\), to \(m_{7}\)), as this is the block size for the LEA-128 cipher. These blocks are processed in groups of eight, resulting in a total of 1024 bits (128 bytes) per iteration. The design ensures efficient processing time and allows for scalability in the hashing of larger data streams. Within each iteration, two operations are performed to generate intermediate \"mini-hash\" values:  
Bitwise XOR operation: Each 64-bit word from the eight blocks is XORed sequentially, resulting in a cumulative XOR value (miniHash1). This operation is fundamental to ensuring cryptographic diffusion. By combining bits from multiple input blocks, the XOR operation propagates any single-bit change in the input across the cumulative value. This sensitivity to input variations helps detect modifications within individual blocks and ensures that all blocks strongly influence the resulting miniHash1 in the group. Additionally, XOR's simplicity ensures high performance even in resource-constrained environments. Addition operation: Simultaneously, the same 64-bit words are added together, yielding a second cumulative value (miniHash2). This addition operation complements the XOR operation by introducing further diffusion into the mini-hash, making the hash sensitive to changes in the magnitude of input variations.