# Research on the Trusted Traceability Model of Taishan Tea Products Based on Blockchain
## 4 Analysis of Blockchain-Based Taishan Tea Traceability Model
### SM2 Encryption Algorithm Optimization
#### 4.2.1 Optimization of SM2 Algorithm Based on Concurrent Processing  
Data encryption plays a decisive role in the security of data, and the performance of encryption algorithms directly affects the performance of data storage and transmission. In SM2 encryption algorithm, the key derivation function needs to utilize bit string and cryptographic hash algorithm to generate the key data bit string, and its algorithm flow is shown in Figure 4 (where Hai denotes the hash value, ct denotes the counter, klen denotes the length of the key, v denotes the step value, and K denotes the final secret key). In the traditional key derivation function, it is necessary to perform a number of subtasks, and the number of subtasks is determined by the length of the key data bits that need to be obtained and the length of the hash value data output by the cryptographic hash algorithm. In the subtasks, the bit string is used to execute the cryptographic hash algorithm by splicing different parameters as inputs, and, finally, the key data bit string is obtained according to splicing the results of multiple subtasks. It can be found that during the execution of the key derivation function, the execution of the bit string in the cryptographic hash algorithm is independent of each other until all the subtasks are executed, and the final result is obtained by splicing the execution results. Based on the above, we draw a flowchart of the operation mechanism of the traditional SM2 encryption algorithm, as shown in Figure 4.  
Based on the above process description, the execution efficiency of the key derivation function depends on the number of subtasks and the execution efficiency of the cryptographic hash algorithm, while, in the actual application process, the length of the bit string is often long, resulting in a large number of subtasks, and the execution efficiency of the cryptographic hash algorithm is difficult to be effectively improved, resulting in the inefficiency of the SM2 cryptography algorithm for encrypting long text. Therefore, this paper proposes an optimization method of SM2 encryption algorithm based on a concurrent processing framework, which combines the process of key derivation function generating key data bit string using bit string and cryptographic hash algorithm with the concurrent processing framework and performs concurrent processing for the  
Figure 4: Flow chart of key derivation function. process of executing cryptographic hash algorithm on the sub-string, which eliminates the waiting time for the process of executing cryptographic hash algorithm many times during the execution of a single process. The algorithmic flow is shown in Figure 5. Based on the above, we constructed a flowchart of the operation mechanism of the improved SM2 encryption algorithm. The subtasks of the key derivation function are decomposed into multiple independent computational units (subtasks). These subtasks can be processed concurrently, avoiding the time delay caused by serial execution. By introducing a concurrent processing framework, multiple subtasks can be executed concurrently in different computational processes. Specifically, the optimized algorithm, after splicing the parameters required for subtasks, assigns these tasks to multiple computational processes at the same time so that each process executes the hash algorithm independently. Under the concurrency framework, the hash operations of subtasks can be performed simultaneously and are no longer executed sequentially. For example, if there are n subtasks and the system supports m concurrent processes, the execution time will be reduced from the original O(n) to O(n/m). This significantly improves the efficiency of encryption execution. After all subtasks are completed, the output of each sub-task is spliced to generate the final key bit string and complete the encryption process.