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

Conversation

Odyhibit
Copy link

closes #1589
When Input is encoded with an offset and spaces it is possible for white space characters to be placed at the beginning of the cipher text. If these characters are trimmed, then decoding will not work without manually adding them back in. For example encoding the text "No one expects the Spanish Inquisition." with the settings key:3 Offset:2 will move 2 spaces to the beginning of the cipher text. So when they are removed by .trim() it makes the decode function unable to recover the original text.
So I just removed the 2 calls to trim, and added in a test using the example above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug report: Someone trimmed the rail fence.
1 participant