This commit is contained in:
cmachsocket
2026-09-19 21:31:39 +08:00
parent 9a16c89714
commit 77a9269828
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -152,7 +152,11 @@ const decrypt = (cipher) => {
const aesEcbEncrypt = (key, plaintext) => {
// 某些运行时不允许使用 null 作为 IV,因此使用 Buffer.alloc(0) ,同时与上下文deriveX25519AesKey等函数保持一致
const cipher = crypto.createCipheriv(`aes-${key.length * 8}-ecb`, key, Buffer.alloc(0))
const cipher = crypto.createCipheriv(
`aes-${key.length * 8}-ecb`,
key,
Buffer.alloc(0),
)
return Buffer.concat([cipher.update(Buffer.from(plaintext)), cipher.final()])
}