crypto_symmetric
Encrypt or decrypt text using AES symmetric encryption with GCM/CBC modes. Supports password-derived keys or direct hex keys, with random IVs for security.
Instructions
对称加解密(现代标准,node:crypto AES)。algorithm 可选:aes-128-gcm、aes-192-gcm、aes-256-gcm、aes-128-cbc、aes-192-cbc、aes-256-cbc。密码经 SHA-256 派生密钥,或直接传 key_hex。GCM 输出格式 base64(iv|tag|密文),CBC 为 base64(iv|密文)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | 明文(encrypt)或 base64 密文(decrypt) | |
| action | No | encrypt | |
| iv_hex | No | 十六进制 IV(默认随机生成) | |
| key_hex | No | 十六进制密钥(优先于 password) | |
| password | No | 口令,用于派生密钥 | |
| algorithm | No | aes-256-gcm |