SM3 (国密) Hash Generator
Free online SM3 (国密) Hash Generator tool. 100% local processing — your data never leaves your device.
Result will be displayed here...
Input → Calculate Hash
Usage Guide
About SM3
SM3 is a cryptographic hash algorithm released by China's State Cryptography Administration in 2010, and is an important component of the Chinese Commercial Cryptography Standard (GM/T 0004-2012). SM3 produces 256-bit (64 hexadecimal characters) hash values with security comparable to SHA-256, specifically designed for Chinese cryptographic application scenarios. SM3 is widely used in China's financial, government, and telecommunications sectors, and is one of the core components of the national cryptography algorithm system. According to the Cryptography Law of the People's Republic of China, important fields involving national security and people's livelihood should use national cryptography algorithms.
Usage Steps
SM3 is a one-way hash function that can only compute hash values and cannot be reversed:
Algorithm Features
SM3 is based on the Merkle-Damgård structure, drawing on SHA-256's design philosophy, with the following technical characteristics:
Application Scenarios
SM3 is widely used in China's critical information infrastructure and commercial cryptography sectors:
FAQ
Q: What's the difference between SM3 and SHA-256?
A: Standard Origin: SM3 is a commercial cryptography standard released by China's State Cryptography Administration (2010), SHA-256 is a federal standard released by the U.S. NIST (2001). Security: Both have comparable security, with 256-bit output and collision resistance complexity of 2^128. Algorithm Design: SM3 uses 132 rounds of message extension, SHA-256 uses 64 rounds; SM3's compression function is slightly different. Performance: Both have similar performance, with SM3 being slightly faster in some scenarios. Compliance: In China's critical sectors, SM3 complies with Cryptography Law requirements, SHA-256 does not. Recommendation: Use SM3 for critical sectors within China, use SHA-256 for international applications.
Q: Which scenarios require mandatory use of SM3?
A: According to the Cryptography Law of the People's Republic of China (effective January 1, 2020) and related industry regulations: Mandatory Use: Commercial cryptography products involving national security, national economy and people's livelihood, and social public interests must be certified by the State Cryptography Administration and use national cryptography algorithms (including SM3). Recommended Use: Critical sectors such as finance (banking, securities, insurance), government (e-government, electronic licenses), telecommunications (mobile communications, IoT), energy (electricity, petroleum), and transportation (railways, civil aviation). Optional Use: General commercial applications and personal applications can choose independently, but using national cryptography algorithms helps improve security and compliance. Note: Specific requirements are subject to the latest laws, regulations, and industry standards.
Q: Can SM3 be used for password storage?
A: Not recommended for direct use. Although SM3 is a secure hash algorithm, its design goal is fast computation, making it vulnerable to brute-force attacks. Correct Approach: Use specialized password hashing algorithms such as Argon2 (OWASP recommended), bcrypt, or PBKDF2-SM3 (using SM3 as the underlying hash function). National Cryptography Solution: If national cryptography algorithms must be used, you can use PBKDF2-SM3 (key derivation function based on SM3) or Argon2-SM3 (SM3 variant of Argon2, requires custom implementation). Note: PBKDF2-SM3 requires a sufficiently high iteration count (≥ 600k) to resist brute-force attacks.
Q: How to use SM3 in international applications?
A: Compatibility Considerations: SM3 is primarily used in China with limited international support. If the application needs to be internationalized, it's recommended to support both SM3 and SHA-256. Dual Algorithm Approach: 1) Negotiation Mechanism: Client and server negotiate the algorithm to use (SM3 within China, SHA-256 abroad). 2) Dual Signatures: Use both SM3 and SHA-256 signatures simultaneously to ensure verification both domestically and internationally. 3) Algorithm Identification: Identify the algorithm used in the data (such as OID), and select the algorithm based on the identifier during verification. Library Support: OpenSSL 1.1.1+ supports SM3, GmSSL is a specialized national cryptography algorithm library.
Q: What's the relationship between SM3 and SM2?
A: SM3 and SM2 are two core components of the national cryptography algorithm system, often used together. SM3: Hash algorithm, used for data integrity verification and message digests. SM2: Asymmetric encryption and digital signature algorithm (based on elliptic curves), used for encryption and signing. Combined Use: When SM2 performs digital signatures, SM3 first calculates the hash value of the message, then the SM2 private key signs the hash value. This is similar to RSA-SHA256 (RSA signature + SHA-256 hash). National Cryptography Suite: SM2-SM3-SM4 is a complete national cryptography algorithm suite, responsible for asymmetric encryption/signing, hashing, and symmetric encryption respectively. Application: National cryptography SSL certificates use the SM2-SM3-SM4 suite, replacing the traditional RSA-SHA256-AES suite.
Q: How to verify the correctness of SM3 implementation?
A: Standard Test Vectors: The GM/T 0004-2012 standard provides official test vectors. For example, input “abc” (3 bytes), SM3 output should be 66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0. Comparison Tools: Use multiple independent implementations (such as OpenSSL, GmSSL, this tool) to calculate the same input and compare results for consistency. Certified Products: If used for commercial cryptography products, use cryptographic modules certified by the State Cryptography Administration. Open Source Implementation: GmSSL (GitHub) is an authoritative open-source implementation of national cryptography algorithms and can be used as a reference.
Use Cases
Recommended: Financial Industry Digital Signatures
Digital signatures for financial institutions such as banks, securities, and insurance should use national cryptography algorithms. Typical process: Use SM3 to calculate the hash value of transaction data, then sign the hash value with SM2 private key. During verification, use SM2 public key to verify the signature and recalculate the hash value with SM3 for comparison. This complies with requirements from regulatory bodies such as the People's Bank of China and the China Banking and Insurance Regulatory Commission.
- ✅ SM2-SM3 (national standard, recommended for finance)
- ✅ SM4 (symmetric encryption, used together)
- ✅ Use cryptographic modules certified by national cryptography
- 💡 Consider dual algorithm approach (SM3 + SHA-256) for improved compatibility
Recommended: Government System Data Exchange
E-government and government data exchange platforms should use national cryptography algorithms to protect data integrity. Use SM3 to calculate hash values of exchanged data to ensure data has not been tampered with during transmission. Combined with SM4 encryption and SM2 signatures, build a complete security system.
- ✅ SM3 (data integrity)
- ✅ SM4 (data encryption)
- ✅ SM2 (digital signatures)
- 💡 Follow 'Technical Requirements for Cryptographic Applications in Government Information Systems'
Recommended: National Cryptography SSL Certificates
National cryptography SSL certificates use the SM2-SM3-SM4 suite, replacing the traditional RSA-SHA256-AES suite. SM3 is used for certificate signing and message authentication during TLS handshake. Applicable to government websites, financial institutions, critical information infrastructure, and other scenarios that need to comply with Cryptography Law requirements.
- ✅ SM2-SM3-SM4 (national cryptography SSL standard suite)
- ✅ Dual certificate approach (national cryptography + RSA, compatible domestically and internationally)
- ✅ Use browsers and servers that support national cryptography
- 💡 Refer to 'SSL VPN Technical Specification' (GM/T 0024-2014)
Recommended: Blockchain and Distributed Ledgers
Domestic blockchain projects (such as FISCO BCOS, ChainMaker) use SM3 as the hash algorithm, complying with national regulatory requirements for blockchain technology. SM3 is used for block hashes, transaction hashes, Merkle trees, and other scenarios, ensuring blockchain data integrity and immutability.
- ✅ SM3 (recommended for domestic blockchain)
- ✅ SHA-256 (international blockchain standard)
- ✅ Combined with SM2 to implement national cryptography blockchain
- 💡 Refer to 'Technical Requirements for Cryptographic Applications in Blockchain'
Recommended: File Integrity Verification
Government and enterprise internal file integrity verification should use SM3. After downloading files, use SM3 to calculate hash values and compare with official values. If hash values match, the file is complete and unmodified. For classified files, SM2 digital signatures should be combined to ensure trustworthy file sources.
- ✅ SM3 + SM2 signature (highest security)
- ✅ SM3 checksum (standard practice)
- ✅ Use file management systems certified by national cryptography
- 💡 Regularly audit file integrity
Recommended: IoT Device Authentication
Scenarios such as telecommunications operators, smart homes, and industrial IoT should use national cryptography algorithms. SM3 is used for device identity authentication, firmware integrity verification, and data integrity protection. Combined with SM4 lightweight encryption, suitable for resource-constrained IoT devices.
- ✅ SM3 (device authentication and data integrity)
- ✅ SM4 (lightweight encryption)
- ✅ SM2 (device certificates and signatures)
- 💡 Refer to 'Technical Requirements for Cryptographic Applications in IoT'
Best Practice Recommendations
- In critical sectors such as finance, government, and telecommunications within China, SM3 should be prioritized to comply with Cryptography Law requirements.
- If the application needs to be internationalized, it's recommended to support both SM3 and SHA-256, selecting algorithms based on region or user.
- Do not use SM3 directly for password storage; use PBKDF2-SM3 or Argon2 and other specialized password hashing algorithms.
- When using national cryptography algorithms, cryptographic modules certified by the State Cryptography Administration should be selected to ensure compliance and security.
- SM3 is typically used together with SM2 (signatures) and SM4 (encryption) to build a complete national cryptography security system.