SM3
China's national 256-bit hash standard, structurally similar to SHA-256
About SM3
SM3 is a cryptographic hash function. It produces a 32-byte (256-bit) output. Its registry entry cites GB/T 32905-2016, GM/T 0004-2012 and ISO/IEC 10118-3:2018. NextSSL lists it in the standard tier and exposes it through the safe API.
Overview
SM3 is the cryptographic hash function standardised by the Chinese State Cryptography Administration. It produces a 256-bit digest and is mandated alongside SM2 signatures and SM4 encryption in Chinese commercial cryptography.
SM3 is a Merkle–Damgård hash over 512-bit blocks with a 256-bit state of eight 32-bit words, very close in outline to SHA-256. It differs in its message expansion, which produces 132 words using a permutation function P1, and in its compression function, which uses 64 rounds whose boolean functions change after the first 16 rounds and which adds extra rotations for diffusion.
The algorithm was published in 2010, standardised as GM/T 0004-2012 and GB/T 32905-2016, and added to ISO/IEC 10118-3 in 2018. It is used in Chinese TLS profiles (TLCP and the SM cipher suites of TLS 1.3 in RFC 8998) and in national PKI deployments. Hardware support for SM3 is available in some ARM processors.
History
2010–2018SM3 published
Specified in GM/T 0004-2012
Specified in GB/T 32905-2016
Specified in ISO/IEC 10118-3:2018
Security notes
No practical attacks on full SM3 are known; published work breaks reduced-round versions only. It offers security comparable to SHA-256 and is appropriate where Chinese standards compliance is required.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| out | 32 | Output |
Use it
from nextssl_demo import NextSSL
ns = NextSSL() # safe API: safe and standard tiers
digest = ns.call("hash_with", "sm3", None, b"abc")[0]
nextssl_hash_with("sm3", NULL, data, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let digest = reg::hash_in(reg::all(), Policy::Safe, "sm3", &Params::new(), b"abc")?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Similar names
Looking for something else?More hash functions
All 424Frequently asked questions
What is SM3?
SM3 is a hash in the SM3 family. SM3 is the cryptographic hash function standardised by the Chinese State Cryptography Administration.
What are the SM3 sizes?
In NextSSL, SM3 uses: output 32 bytes.
Who designed SM3 and when?
SM3 belongs to the SM3 family, first published in 2010. Its origin: GB/T 32905-2016; GM/T 0004-2012; ISO/IEC 10118-3:2018.
Which standards define SM3?
SM3 is referenced by GB/T 32905-2016, GM/T 0004-2012, ISO/IEC 10118-3:2018.
Is SM3 safe to use?
SM3 is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.