SM4EncryptECB

Cryptography

Description

Encrypts a payload with SM4 in ECB mode under a 16-byte key

Syntax

Delphi

Function SM4EncryptECB(Const Key, Plaintext: AnsiString): AnsiString;

Parameters

KeyExactly 16 bytes
PlaintextLength 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

SM4DecryptECB, SM4EncryptCBC, PLSM4EncryptBlock, PLSM4InitKey