🐛 Do not skip encryption header in decryptChunk

This commit is contained in:
C-3PO 2018-07-05 03:03:26 +02:00
parent 213fcf91f7
commit 02f4d3ecb5
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -10,10 +10,7 @@ export default function decryptChunk(encryptedChunk: Buffer, [key0, key1, key2]:
const keyPart = (key2 | 2) & 0xFFFF; const keyPart = (key2 | 2) & 0xFFFF;
const decryptedByte = (keyPart * (keyPart ^ 1)) >>> 8; const decryptedByte = (keyPart * (keyPart ^ 1)) >>> 8;
curChar ^= decryptedByte & 0xFF; curChar ^= decryptedByte & 0xFF;
//Skip the first 12 bytes (random encryption header) dvOut.setUint8(i, curChar);
if (i >= 12) {
dvOut.setUint8(i - 12, curChar);
}
//update keys //update keys
[key0, key1, key2] = updateKeys([key0, key1, key2], curChar); [key0, key1, key2] = updateKeys([key0, key1, key2], curChar);