From 2e0aa7ae877bd702cc6b9ad4c44f300c5e9ed613 Mon Sep 17 00:00:00 2001 From: Scott Howard Date: Wed, 15 Jul 2020 22:05:15 -0400 Subject: [PATCH 1/2] Don't pad rail fence decode fixes #1069 --- src/core/operations/RailFenceCipherDecode.mjs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/core/operations/RailFenceCipherDecode.mjs b/src/core/operations/RailFenceCipherDecode.mjs index d98742b8..058c3b7d 100644 --- a/src/core/operations/RailFenceCipherDecode.mjs +++ b/src/core/operations/RailFenceCipherDecode.mjs @@ -59,13 +59,6 @@ class RailFenceCipherDecode extends Operation { } const cycle = (key - 1) * 2; - - const rest = cipher.length % key; - - if (rest !== 0) { - cipher = cipher + (" ".repeat(key - rest)); - } - const plaintext = new Array(cipher.length); let j = 0; From 7989f119d3deeb5a08b7d01edf7c69d16994c84d Mon Sep 17 00:00:00 2001 From: n1073645 <57447333+n1073645@users.noreply.github.com> Date: Thu, 16 Jul 2020 09:56:30 +0100 Subject: [PATCH 2/2] Linting Modifications --- src/core/operations/RailFenceCipherDecode.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/operations/RailFenceCipherDecode.mjs b/src/core/operations/RailFenceCipherDecode.mjs index 058c3b7d..be54ee12 100644 --- a/src/core/operations/RailFenceCipherDecode.mjs +++ b/src/core/operations/RailFenceCipherDecode.mjs @@ -46,7 +46,7 @@ class RailFenceCipherDecode extends Operation { run(input, args) { const [key, offset] = args; - let cipher = input; + const cipher = input; if (key < 2) { throw new OperationError("Key has to be bigger than 2");