HomeSM4 Block Cipher Algorithm

SM4 Block Cipher Algorithm

Chinese commercial cryptography standard SM4 algorithm, 128-bit block symmetric encryption, supporting CBC/ECB/CTR modes with automatic key and IV generation

SM4 Block Cipher

Encrypt

Decrypt



Documentation

This tool performs SM4 encryption and decryption with local browser-side processing, supporting multiple modes and format conversions.

Key Features

  • Modes: ECB, CBC, and CTR
  • Generate random key and IV
  • Input/output formats: Text/Base64/Hex/Spaced Hex/C-style Hex
  • One-click copy for encryption/decryption result

Steps

  1. Select mode and prepare key (IV required for CBC/CTR).
  2. Choose input/output formats.
  3. Enter plaintext or ciphertext and run encryption/decryption.
  4. Copy output for integration.

Use Cases

  • SM4 interoperability and integration testing
  • Local client-side encryption demos
  • Learning and validating national symmetric crypto flows

Notes

  • ECB does not use IV, while CBC/CTR requires correct IV.
  • Both sides must use identical mode, key, and IV.
  • In production, combine with secure key distribution and storage.