From 61b3770f241851a78e534c7d645cef25521aef97 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Fri, 2 Nov 2018 00:56:18 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=91=20Remove=20unneeded=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ssn/decryption/decryptChunk.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/ssn/decryption/decryptChunk.ts b/src/ssn/decryption/decryptChunk.ts index afd5261..3761fde 100644 --- a/src/ssn/decryption/decryptChunk.ts +++ b/src/ssn/decryption/decryptChunk.ts @@ -3,12 +3,10 @@ import updateKeys from './lib/updateKeys'; export default function getDecryptor(decryptionKeys: [number, number, number]) { let [key0, key1, key2] = decryptionKeys; - return (encryptedChunk: Buffer) => { - //const decryptedChunk = Buffer.alloc(encryptedChunk.length); - - for (let i = 0; i < encryptedChunk.length; i += 1) { + return (chunk: Buffer) => { + for (let i = 0; i < chunk.length; i += 1) { //read byte - let curChar = encryptedChunk.readUInt8(i); + let curChar = chunk.readUInt8(i); //decrypt byte const keyPart = (key2 | 2) & 0xFFFF; @@ -19,11 +17,9 @@ export default function getDecryptor(decryptionKeys: [number, number, number]) { [key0, key1, key2] = updateKeys([key0, key1, key2], curChar); //write byte - //decryptedChunk.writeUInt8(curChar, i); - encryptedChunk.writeUInt8(curChar, i); + chunk.writeUInt8(curChar, i); } - //return decryptedChunk; - return encryptedChunk; + return chunk; }; }