From 32b0c39444c2f561ad20ab06475fd986cdd5e7f6 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Sun, 8 Jul 2018 22:32:08 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Some=20more=20possible=20decrypt?= =?UTF-8?q?ion=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ssn/decryption/decryptChunk.ts | 2 +- src/ssn/decryption/lib/updateKeys.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ssn/decryption/decryptChunk.ts b/src/ssn/decryption/decryptChunk.ts index b733a85..fcab808 100644 --- a/src/ssn/decryption/decryptChunk.ts +++ b/src/ssn/decryption/decryptChunk.ts @@ -12,7 +12,7 @@ export default function getDecryptor(decryptionKeys: [number, number, number]) { let curChar = encryptedChunk.readUInt8(i); //decrypt byte - const keyPart = (key2 | 2) & 0xFFFF; + const keyPart = ((key2 | 2) >>> 0) & 0xFFFF; const decryptedByte = int32Mul(keyPart, keyPart ^ 1) >>> 8; curChar = (curChar ^ (decryptedByte & 0xFF)) & 0xFF; diff --git a/src/ssn/decryption/lib/updateKeys.ts b/src/ssn/decryption/lib/updateKeys.ts index 986bd0d..966c073 100644 --- a/src/ssn/decryption/lib/updateKeys.ts +++ b/src/ssn/decryption/lib/updateKeys.ts @@ -3,7 +3,7 @@ import int32Mul from './int32Mul'; export default function updateKeys([key0, key1, key2]: [number, number, number], curChar: number): [number, number, number] { key0 = getCrc(key0, curChar); - key1 = ((int32Mul(((key1 + (key0 & 0xFF)) >>> 0), 134775813) >>> 0) + 1) >>> 0; + key1 = ((int32Mul((((key1 >>> 0) + ((key0 >>> 0) & 0xFF)) >>> 0), 134775813) >>> 0) + 1) >>> 0; key2 = getCrc(key2, key1 >>> 24); return [key0, key1, key2];