From 52157f544c51ce5af37f02552dc8b986df50e1d8 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Sun, 24 Jun 2018 02:15:46 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20length=20calculation=20dur?= =?UTF-8?q?ing=20decryption?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ssn/decryption/decryptFile.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ssn/decryption/decryptFile.ts b/src/ssn/decryption/decryptFile.ts index a9780fe..996fd6b 100644 --- a/src/ssn/decryption/decryptFile.ts +++ b/src/ssn/decryption/decryptFile.ts @@ -1,7 +1,7 @@ import updateKeys from './updateKeys'; export default function decryptFile(dv: DataView, length: number, [key0, key1, key2]: [number, number, number]) { - const decryptedBuffer = new ArrayBuffer(dv.byteLength - 12); + const decryptedBuffer = new ArrayBuffer(length - 12); const dvOut = new DataView(decryptedBuffer); for (let i = 0; i < length; i += 1) { @@ -19,6 +19,5 @@ export default function decryptFile(dv: DataView, length: number, [key0, key1, k [key0, key1, key2] = updateKeys([key0, key1, key2], curChar); } - //If it was decrypted, we skip the first 12 bytes (random encryption header) return dvOut; }