SM4EncryptCBC
Cryptography
Description
Encrypts a payload with SM4 in CBC mode under a 16-byte key and 16-byte IV
Syntax
Delphi
Function SM4EncryptCBC(Const Key, IV, Plaintext: AnsiString): AnsiString;Parameters
| Key | Exactly 16 bytes |
|---|---|
| IV | Exactly 16 bytes; each block is chained with the previous ciphertext block |
| Plaintext | Length must be a multiple of 16 |
Return values
| The ciphertext of the same length, or an empty string on any invalid input |
Remarks
Part of the pure-Pascal SM4 block cipher (GB/T 32907-2016); the implementation passes the standard single-block vector, the published first round key and the one-million-iteration vector
The payload length must be a multiple of 16; there is no padding layer
See also
SM4DecryptCBC, SM4EncryptECB, PLSM4EncryptBlock, PLSM4InitKey