Skip to main content

AES

算法 AES/CBC/PKCS7Padding 256

示例

const secretKey = "my-secret-key";
const plaintext = "hello world!";

const encryptedString = luwak.crypto.aesEncrypt(secretKey, plaintext);

// encryptedString = "Bfnlt6vrSJwK2gR7YJKlFYV0NcGK3com6ohQm+BFj9gHojkrk8IA6kEcdiXTrifK"

const decryptedString = luwak.crypto.aesDecrypt(secretKey, encryptedString);

// decryptedString = "hello world!"

luwak.returnResult(decryptedString);

注意: 多次加密相同的明文,会产生不同的密文。目的是为了增加随机性,防止模式重用攻击。