SM4 Cipher
Encrypt or decrypt with the Chinese national standard SM4 in ECB or CBC mode with PKCS#7 padding. 128-bit key.
Mode
16 bytes · SM4 uses exactly 16 bytes
When off, the data length must be a multiple of the block size
Output
Result
The result will appear here
SM4 is defined in GB/T 32907-2016: 128-bit blocks, 128-bit keys, 32 rounds. This implementation is verified against the test vector in the standard appendix and cross-checked byte for byte against OpenSSL sm4-ecb.
ECB encrypts identical plaintext blocks to identical ciphertext blocks, exposing patterns. CBC mixes the previous ciphertext block into each block, hiding them, but the IV must be random and never reused.
Comments
No comments yet — be the first to say something