SM4 Block Cipher
SM4 Chinese commercial symmetric block cipher algorithm, block and key length both 128 bits, supports ECB/CBC modes.
Configuration
Key
Encrypt
Decrypt
Instructions
About SM4
SM4 is a commercial symmetric block cipher released by the State Cryptography Administration of China, with 128-bit block and key lengths, supporting ECB and CBC modes. Comparable in security to AES-128, widely used for data encryption in transit.
Mode Description
SM4/ECB: Electronic Codebook mode, each block encrypted independently, same plaintext produces same ciphertext, suitable for short data encryption; SM4/CBC: Cipher Block Chaining mode, each block XORed with previous ciphertext block before encryption, requires initialization vector (IV), more secure, recommended. This tool's CBC mode uses the first 16 bytes of the key as IV by default.
Steps
1. Select encryption mode (ECB/CBC); 2. Enter plaintext and key (16 characters); 3. In CBC mode, also enter IV (16 characters); 4. Click 'Encrypt' or 'Decrypt'.
Notes
Key must be exactly 16 characters (128 bits); in CBC mode, IV must also be 16 characters; ECB mode is not suitable for encrypting large amounts of data (same plaintext blocks produce same ciphertext blocks); CBC mode is more secure and recommended.