mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2024-12-29 10:56:18 +00:00
Removed autopadding from ecb cipher
This commit is contained in:
parent
a16b7347c2
commit
2e10236ece
|
@ -8,11 +8,13 @@ function _md5 (data, type = 'binary') {
|
||||||
|
|
||||||
function _ecbCrypt (key, data) {
|
function _ecbCrypt (key, data) {
|
||||||
let cipher = crypto.createCipheriv("aes-128-ecb", Buffer.from(key), Buffer.from(""));
|
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();
|
return Buffer.concat([cipher.update(data, 'binary'), cipher.final()]).toString("hex").toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _ecbDecrypt (key, data) {
|
function _ecbDecrypt (key, data) {
|
||||||
let cipher = crypto.createDecipheriv("aes-128-ecb", Buffer.from(key), Buffer.from(""));
|
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();
|
return Buffer.concat([cipher.update(data, 'binary'), cipher.final()]).toString("hex").toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue