Optimizing the SM4 Encryption Algorithm for Blockchain Security
摘要
Encryption algorithms play a critical role in ensuring data security. However, challenges such as slow operation and suboptimal efficiency arise during the encryption and decryption processes. Improving encryption efficiency has emerged as a critical objective. In this paper, we investigate the intricacies of the SM4 encryption algorithm, identifying complex iterations and computations. Through adopting a more efficient mathematical approach and streamlining processes, we achieve significant improvements in encryption efficiency. Through extensive research in GPU parallel computing, we propose an efficient encryption algorithm based on CUDA streams. This approach carefully considers the characteristics of both the CPU and the GPU, enabling the parallelization of the SM4 block encryption process. It also optimizes byte substitution and left shift operations, resulting in an optimal solution. The integration of fundamental method optimization with GPU parallel computing consistently improves encryption efficiency. Our encryption algorithm consistently outperforms the CUDA-based SM4 algorithm for large volumes of data, especially beyond 30 MB. With a data volume of 1 KB, our improved CUDA stream-based SM4 algorithm consistently outperforms the CUDA-based SM4 algorithm by 0.24μs. With a data volume of 30 MB, our algorithm is nearly 400μs faster. We leverage the security and privacy benefits of the optimized SM4 encryption algorithm by integrating it with blockchain technology. This ensures the security of sensitive information and strengthens the integrity and security of the blockchain system. This approach not only secures data, but also promotes broader adoption of blockchain technology across industries, enhancing its reliability and trustworthiness.