Skip to content

Columnar cipher drops trailing whitespace during roundtrip #14

Description

@aeitwoen

The columnar cipher cannot roundtrip plaintext ending in whitespace because both encodeColumnar() and decodeColumnar() call trimEnd(). Legitimate trailing spaces and newlines get treated like padding and disappear.

This showed up while checking transposition roundtrips with non-letter input. For example, encoding and then decoding "A ", "A ", or "A\n" with key KEY returns "A" in every case. The library defaults stripNonAlpha to false, so silently losing those characters is pretty surprising. Padding should be removed without trimming user content, with regression cases for trailing spaces and a trailing newline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions