SM2/SM3/SM4 Crypto Tool
CodeSwordsman SM Crypto is a free online Chinese national cryptographic algorithm tool supporting SM2 asymmetric encryption/decryption with signature/verification, SM3 hash computation with HMAC, SM4 symmetric encryption/decryption with ECB/CBC modes. All processing done locally in your browser.
About This Tool
SM Crypto Tool is a free online implementation of China's national cryptographic algorithms: SM2 asymmetric encryption with signing and verification, SM3 hashing with HMAC and iterative rounds, and SM4 symmetric encryption in ECB or CBC mode. Each tab exposes the parameters you need, including cipher mode, output format and one-click key generation.
Everything runs locally in your browser, so keys, plaintext and ciphertext never leave your device. It is used for national-standard compliance checks, API integration testing and learning how the SM family differs from RSA, SHA-256 and AES, without installing a cryptography toolchain.
Features
SM2 Asymmetric Encryption
Supports SM2 public key encryption, private key decryption, private key signing and public key verification with C1C2C3/C1C3C2 cipher modes
SM3 Hash Computation
Chinese national hash algorithm generating 256-bit digest, supports HMAC message authentication and multi-round iteration
SM4 Symmetric Encryption
Chinese national block cipher algorithm supporting ECB/CBC modes with 128-bit key for secure data transmission
Multiple Output Formats
Supports Hex/Base64 output switching and case conversion for different integration scenarios
Key Management
One-click SM2 key pair generation, SM4 random key and IV generation with copy and custom input support
Privacy & Security
All SM algorithm computations are performed locally in your browser, no data is ever uploaded to any server
How to Use
- 1Select a tab: Switch to 'SM2 Asymmetric', 'SM3 Hash', or 'SM4 Symmetric' panel based on your needs
- 2For SM2: Click 'Generate Key Pair' to get public/private keys, choose operation mode (Encrypt/Decrypt or Sign/Verify), enter text and click the corresponding button
- 3For SM3: Enter text in the input box, optionally configure HMAC key, output format (case), and iteration rounds, then click 'Compute SM3'
- 4For SM4: Enter or randomly generate a 128-bit key, select ECB/CBC mode and output format (Hex/Base64), enter text and click Encrypt or Decrypt
- 5Results will appear instantly in the output area. Click the 'Copy' button to quickly copy the result
Use Cases
National Cryptography Compliance
Meet national cryptography compliance requirements in finance, government, and telecommunications industries. Perform SM2/SM3/SM4 encryption verification online without installing any software
Encrypted Data Transmission
Use SM4 symmetric encryption for sensitive data with ECB/CBC modes and Hex/Base64 output formats, compatible with various API integrations
Digital Signature & Verification
Leverage SM2 asymmetric encryption for data signing and verification, ensuring data authenticity and content integrity
Hash Verification & HMAC
Generate 256-bit digest values using SM3, with HMAC message authentication and multi-round iteration support for data integrity verification
FAQ
What are SM2, SM3, and SM4?
SM2 is an asymmetric encryption algorithm based on elliptic curve cryptography, used for encryption/decryption and digital signatures. SM3 is a hash algorithm that generates 256-bit digest values, similar to SHA-256. SM4 is a symmetric block cipher with 128-bit keys, similar to AES. All three are Chinese national cryptographic standards published by the State Cryptography Administration.
What is the difference between SM2 and RSA?
SM2 is based on elliptic curve cryptography (ECC), offering shorter keys and faster computation at equivalent security levels. A 256-bit SM2 key provides security comparable to a 3072-bit RSA key. SM2 is a Chinese-designed cryptographic standard.
What is the difference between SM4 ECB and CBC modes?
ECB mode encrypts each data block independently, producing identical ciphertext for identical plaintext blocks, suitable for short data. CBC mode XORs the previous ciphertext block with the current plaintext block before encryption, providing higher security and is recommended. CBC mode requires an additional initialization vector (IV).
Does this tool upload my data?
No. All SM2/SM3/SM4 computations are performed locally in your browser. None of your input text, keys, or results are ever sent to any server, ensuring complete data security.
What is the difference between SM3 and MD5/SHA-256?
SM3 is a Chinese national standard hash algorithm that outputs 256-bit digest values with security comparable to SHA-256. In scenarios requiring national cryptography compliance, SM3 should be used instead of MD5 or SHA family algorithms.
How are keys generated and managed?
SM2 supports one-click key pair generation (public key + private key). SM4 supports random 128-bit key and IV generation. Generated keys can be copied with one click, and manual input of existing keys is also supported. Keep your private keys safe and never share them.
About This Tool
SM Crypto Tool is a free online implementation of China's national cryptographic algorithms: SM2 asymmetric encryption with signing and verification, SM3 hashing with HMAC and iterative rounds, and SM4 symmetric encryption in ECB or CBC mode. Each tab exposes the parameters you need, including cipher mode, output format and one-click key generation.
Everything runs locally in your browser, so keys, plaintext and ciphertext never leave your device. It is used for national-standard compliance checks, API integration testing and learning how the SM family differs from RSA, SHA-256 and AES, without installing a cryptography toolchain.
Key Features
SM2 Asymmetric Encryption
Supports SM2 public key encryption, private key decryption, private key signing and public key verification with C1C2C3/C1C3C2 cipher modes
SM3 Hash Computation
Chinese national hash algorithm generating 256-bit digest, supports HMAC message authentication and multi-round iteration
SM4 Symmetric Encryption
Chinese national block cipher algorithm supporting ECB/CBC modes with 128-bit key for secure data transmission
Multiple Output Formats
Supports Hex/Base64 output switching and case conversion for different integration scenarios
Key Management
One-click SM2 key pair generation, SM4 random key and IV generation with copy and custom input support
Privacy & Security
All SM algorithm computations are performed locally in your browser, no data is ever uploaded to any server
When to Use It
National Cryptography Compliance
Meet national cryptography compliance requirements in finance, government, and telecommunications industries. Perform SM2/SM3/SM4 encryption verification online without installing any software
Encrypted Data Transmission
Use SM4 symmetric encryption for sensitive data with ECB/CBC modes and Hex/Base64 output formats, compatible with various API integrations
Digital Signature & Verification
Leverage SM2 asymmetric encryption for data signing and verification, ensuring data authenticity and content integrity
Hash Verification & HMAC
Generate 256-bit digest values using SM3, with HMAC message authentication and multi-round iteration support for data integrity verification
How to Use It
- 1Select a tab: Switch to 'SM2 Asymmetric', 'SM3 Hash', or 'SM4 Symmetric' panel based on your needs
- 2For SM2: Click 'Generate Key Pair' to get public/private keys, choose operation mode (Encrypt/Decrypt or Sign/Verify), enter text and click the corresponding button
- 3For SM3: Enter text in the input box, optionally configure HMAC key, output format (case), and iteration rounds, then click 'Compute SM3'
- 4For SM4: Enter or randomly generate a 128-bit key, select ECB/CBC mode and output format (Hex/Base64), enter text and click Encrypt or Decrypt
- 5Results will appear instantly in the output area. Click the 'Copy' button to quickly copy the result
Frequently Asked Questions
What are SM2, SM3, and SM4?
SM2 is an asymmetric encryption algorithm based on elliptic curve cryptography, used for encryption/decryption and digital signatures. SM3 is a hash algorithm that generates 256-bit digest values, similar to SHA-256. SM4 is a symmetric block cipher with 128-bit keys, similar to AES. All three are Chinese national cryptographic standards published by the State Cryptography Administration.
What is the difference between SM2 and RSA?
SM2 is based on elliptic curve cryptography (ECC), offering shorter keys and faster computation at equivalent security levels. A 256-bit SM2 key provides security comparable to a 3072-bit RSA key. SM2 is a Chinese-designed cryptographic standard.
What is the difference between SM4 ECB and CBC modes?
ECB mode encrypts each data block independently, producing identical ciphertext for identical plaintext blocks, suitable for short data. CBC mode XORs the previous ciphertext block with the current plaintext block before encryption, providing higher security and is recommended. CBC mode requires an additional initialization vector (IV).
Does this tool upload my data?
No. All SM2/SM3/SM4 computations are performed locally in your browser. None of your input text, keys, or results are ever sent to any server, ensuring complete data security.
What is the difference between SM3 and MD5/SHA-256?
SM3 is a Chinese national standard hash algorithm that outputs 256-bit digest values with security comparable to SHA-256. In scenarios requiring national cryptography compliance, SM3 should be used instead of MD5 or SHA family algorithms.
How are keys generated and managed?
SM2 supports one-click key pair generation (public key + private key). SM4 supports random 128-bit key and IV generation. Generated keys can be copied with one click, and manual input of existing keys is also supported. Keep your private keys safe and never share them.
