常量SM4 对象式 API,实例保存 key、mode、padding 与可选 IV 配置。
使用 SM4 解密数据 Decrypt data using SM4 block cipher
支持的模式 (Supported modes):
支持的填充模式 (Supported padding modes):
解密密钥(十六进制字符串,32 个字符 = 16 字节) Decryption key (hex string, 32 chars = 16 bytes)
加密的数据(十六进制字符串或 AEAD 结果对象) Encrypted data (hex string or AEAD result object)
可选options: SM4DecryptOptions
解密选项(模式、填充、IV、tag用于 GCM/CCM) Decryption options (mode, padding, IV, tag for GCM/CCM)
解密后的数据(UTF-8 字符串) Decrypted data (UTF-8 string)
使用 SM4 解密为原始字节;文本入口会额外执行 UTF-8 解码。
固定 16 字节的密钥或 32 个 Hex 字符
字符串、原始密文字节或带 tag 的结构化结果
可选options: SM4DecryptOptions
mode、padding、IV/nonce、AAD、tag 与输入编码
解密并完成填充/AEAD 校验后的原始字节
使用 SM4 加密数据 Encrypt data using SM4 block cipher
支持的模式 (Supported modes):
支持的填充模式 (Supported padding modes):
加密密钥(十六进制字符串,32 个字符 = 16 字节) Encryption key (hex string, 32 chars = 16 bytes)
要加密的数据(字符串或 Uint8Array) Data to encrypt (string or Uint8Array)
可选options: SM4Options
加密选项(模式、填充、IV) Encryption options (mode, padding, IV)
小写十六进制字符串形式的加密数据,或GCM模式下返回包含密文和标签的对象 Encrypted data as lowercase hex string, or object with ciphertext and tag for GCM mode
SM4 分组密码算法模块。 聚合所有具名函数与对象式入口 SM4Class。