Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Rail Fence encode/decode trim issue #1590

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-transform-builtin-extend": "1.1.2",
"base64-loader": "^1.0.0",
"chromedriver": "^110.0.0",
"chromedriver": "^114.0.2",
"cli-progress": "^3.12.0",
"colors": "^1.4.0",
"copy-webpack-plugin": "^11.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/RailFenceCipherDecode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class RailFenceCipherDecode extends Operation {
}
}

return plaintext.join("").trim();
return plaintext.join("");
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/RailFenceCipherEncode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class RailFenceCipherEncode extends Operation {
rows[rowIdx] += plaintext[pos];
}

return rows.join("").trim();
return rows.join("");
}

}
Expand Down
11 changes: 11 additions & 0 deletions tests/operations/tests/Ciphers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -528,4 +528,15 @@ TestRegister.addTests([
}
],
},
{
name: "Rail Fence Cipher Encode: Normal with Offset with Spaces",
input: "No one expects the spanish Inquisition.",
expectedOutput: " e n ut.ooeepcstesaihIqiiinNnxthpsnso",
recipeConfig: [
{
"op": "Rail Fence Cipher Encode",
"args": [3, 2]
}
],
},
]);