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; }