🐛 Fix length calculation during decryption
This commit is contained in:
parent
589f7fe786
commit
52157f544c
1 changed files with 1 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
import updateKeys from './updateKeys';
|
import updateKeys from './updateKeys';
|
||||||
|
|
||||||
export default function decryptFile(dv: DataView, length: number, [key0, key1, key2]: [number, number, number]) {
|
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);
|
const dvOut = new DataView(decryptedBuffer);
|
||||||
|
|
||||||
for (let i = 0; i < length; i += 1) {
|
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);
|
[key0, key1, key2] = updateKeys([key0, key1, key2], curChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
//If it was decrypted, we skip the first 12 bytes (random encryption header)
|
|
||||||
return dvOut;
|
return dvOut;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue