From 2e10236ecebd69171527170e417cabd46a24c0c8 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 8 Jun 2021 19:43:33 +0200 Subject: [PATCH] Removed autopadding from ecb cipher --- deemix/utils/crypto.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deemix/utils/crypto.js b/deemix/utils/crypto.js index 50cd4a9..4623d3d 100644 --- a/deemix/utils/crypto.js +++ b/deemix/utils/crypto.js @@ -8,11 +8,13 @@ function _md5 (data, type = 'binary') { function _ecbCrypt (key, data) { let cipher = crypto.createCipheriv("aes-128-ecb", Buffer.from(key), Buffer.from("")); + cipher.setAutoPadding(false) return Buffer.concat([cipher.update(data, 'binary'), cipher.final()]).toString("hex").toLowerCase(); } function _ecbDecrypt (key, data) { let cipher = crypto.createDecipheriv("aes-128-ecb", Buffer.from(key), Buffer.from("")); + cipher.setAutoPadding(false) return Buffer.concat([cipher.update(data, 'binary'), cipher.final()]).toString("hex").toLowerCase(); }