Removed autopadding from ecb cipher

This commit is contained in:
RemixDev 2021-06-08 19:43:33 +02:00
parent a16b7347c2
commit 2e10236ece

View file

@ -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();
}