1
0
forked from um/web

Fix Decrypt Algorithm Error

This commit is contained in:
MengYX 2020-02-11 17:03:46 +08:00
parent cc8e818142
commit ce251e3c9e
No known key found for this signature in database
GPG Key ID: E63F9C7303E8F604

View File

@ -90,10 +90,15 @@ class QmcMask {
Decrypt(data) {
let dst = data.slice(0);
let index = -1;
let maskIdx = -1;
for (let cur = 0; cur < data.length; cur++) {
index++;
maskIdx++;
if (cur === 0x8001 || (cur > 0x8001 && cur % 0x8000 === 0)) maskIdx++;
if (index === 0x8000 || (index > 0x8000 && (index + 1) % 0x8000 === 0)) {
index++;
maskIdx++;
}
if (maskIdx >= 128) maskIdx -= 128;
dst[cur] ^= this.Matrix128[maskIdx];
}