DB dump tool feature complete

This commit is contained in:
zadam
2022-02-12 22:20:15 +01:00
parent 67cce5f817
commit 5481375347
10 changed files with 1043 additions and 716 deletions

View File

@@ -1,4 +1,4 @@
import crypto from "crypto";
const crypto = require("crypto");
function decryptString(dataKey, cipherText) {
const buffer = decrypt(dataKey, cipherText);
@@ -59,6 +59,19 @@ function decrypt(key, cipherText, ivLength = 13) {
}
}
function pad(data) {
if (data.length > 16) {
data = data.slice(0, 16);
}
else if (data.length < 16) {
const zeros = Array(16 - data.length).fill(0);
data = Buffer.concat([data, Buffer.from(zeros)]);
}
return Buffer.from(data);
}
function arraysIdentical(a, b) {
let i = a.length;
if (i !== b.length) return false;