Secure And Trust

Home
About Dahua

...

Secure And Trust

SM3 Cryptographic Hash Algorithm in a Nutshell

SM3 Cryptographic Hash Algorithm in a Nutshell

2026-02-11

The SM3 cryptographic hash algorithm, released by the National Cryptography Administration, is a standardized cryptographic hash function primarily used for digital signature generation and verification, message authentication code (MAC) generation and validation, as well as random number generation. It meets the security requirements for various cryptographic applications. The detailed algorithm implementation process is illustrated in Figure 1.



Figure 1: SM3 Cryptographic Hash Algorithm Implementation Stream


The "Iteration Compression" process in Figure 1 is the core process of the SM3 cryptographic hash function, and the CF algorithm implementation of the compression function involved in this process is described in detail below.

1.      First, expand the message block B(i) using the following method to generate 132 words: W0, W1, …, W67,W’0,W’1, …, W’63:

1)       Divide message block B(i) into 16 words W0,W1,…,W15.

2)       For j =16 to 67

Wj←P1(Wj-16Wj-9(Wj-3<<<15)) (Wj-13<<<7) Wj-6

For j =0 to 63

W’j=Wj⊕Wj+4

2.      Let A, B, C, D, E, F, G, H be word registers, and SS1, SS2, TT1, TT2 be the middle variables. The compression function is defined as V(i+1)=CF(V(i),B(i)),0≤in-1. The calculation process is illustrated in Figure 2.



Figure 2: Compression Function Calculation Process


Among these, V(0)=7380166f 4914b2b9 172442d7 da8a0600 a96f30bc 163138aa e38dee4 db0fb0e4e


Tj=79cc4519 0≤j≤157a879d8a16≤j≤63

FFj (X,Y,Z)=XYZ 0≤j≤15X˄Y˅X˄Z˅Y˄Z 16≤j≤63

GGj(X,Y,Z)=XYZ 0≤j≤15X˄Y˅¬X˄Z 16≤j≤63


The SM3 Cryptographic Hash Algorithm Standard is released as the international standard ISO/IEC 10118-3:2018 titled "Information Technology – Security Techniques – Hash-Functions – Part 3: Dedicated Hash-Functions. SM3 provides a broader standardization reference for product usage cryptographic hashing algorithms, thereby enhancing the trustworthiness and interoperability of high-security products.


The analyses and discussions in the article are intended to share industry dynamics and technical practices. If any issue involving intellectual property rights arises, please do not hesitate to contact us. We will handle your concerns and make necessary adjustments in accordance with relevant laws and regulations.